I have one page Country.aspx through that i add country in my database...
I have another page name State.aspx through which i can add states in my database..
Now The country i have added in database through first page when i want to add states in
database i want that added country to be shown in drop down list in my state.aspx page..
here in state.aspx page i have one drop down for country which i select and one textbox for
state which i want to add...how can i add states with this....here when i click on save the state
should be saved in database
how can i do that??
I have taken three different tables name country,state and city for that and 3 different pages
country.aspx,state.aspx,city.aspx ..
Dorababu MekaPosted Feb 16, 2013, 1:15 AM
Ok do you want to display the country that you saved from the previous page or do you want to pull out all the countries and bind them to drop down in state page.
If you would like to pull out all countries you can write a query like
select countryname,countryid from tblcountry;
In your page load of states you can code this
SqlConnection con=new SqlConnection(connectionstring);
sqlcommand cmd=new Sqlcommand("select countryname,countryid from tblcountry",con);
con.open();
DataSet ds=new DataSet();
SqlDataAdapter da=new SqlDataAdapter();
da.Selectcommand=cmd;
da.Fill(ds);
ddlcountry.DataSource = ds;
the same way for states in city page