One Listbox showing all cities. If you select one city in
list box the information related to that particular city
should be displayed in Datagrid . How do you do that?

Answer Posted / sathish

protected void ddlcity_SelectedIndexChanged(object sender,
EventArgs e)
{
sqlConnection con= new sqlConnection(" ");
string str="select * from table where city ='" +
ddlcity.SelectItem.Text ="'";
sqlDataAdapter da= new slqDataAdapter(str,con)
dataset ds = new dataset;
da.fill(ds,"City");
dgview.datasource=ds.tables["City"];
dgview.dataBind();
}

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is state management technique?

545


Describe the application event handlers in ASP.NET?

550


what are configuration files?

565


Differentiate between client-side and server-side validations in web pages.

563


Where session variables are stored?

546






What is web router?

505


Is session stored in browser?

529


What is synchronous and Asynchronous post back ?

646


Why we go for mvc instead of asp.net? : Asp.Net MVC

496


Can I have a unique key as foreign key?

543


Difference between singleton and singlecall.

573


How will you load dynamic assembly? How will create assesblies at run time?

461


Explain the path instructions in xaml?

565


Describe a Windows Service and its lifecycle ?

627


Does web services support data reader like pom project?

533