Thursday, 6 June 2013

Cascading Dropdown List for Country/State/City in ASP.Net

Cascading Dropdown List for Country/State/City in ASP.Net


I am going to show how we can work with cascading dropdown list for country/state/city in asp.net 


Create three tables as per our need
CREATE TABLE country
  (
     countryID     INT NOT NULL,
     countryName   varchar(50) NOT NULL,
     PRIMARY KEY (countryID ),
  );
CREATE TABLE state
  (
 stateID     INT NOT NULL,
 countryID INT NOTNULL,
 stateName   varchar(50) NOT NULL,
 PRIMARY KEY (stateID ),
 FOREIGN KEY (countryID ) REFERENCES country (countryID));

CREATE TABLE city
  (
cityID     INT NOT NULL,
 stateID INT NOTNULL,
 cityName   varchar(50) NOT NULL,
 PRIMARY KEY (cityID),
 FOREIGN KEY (stateID) REFERENCES state (stateID));

No comments:

Post a Comment