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 the difference between sealed vs static class?

780


What are client activated objects and server activated objects?

717


What is the page life cycle in asp.net?

748


How to display Alert in ASP.NET

838


How you will manage the state of ASP.NET controls?

763


how to write html code with ssl

1769


Error : The operation couldn’t be performed because ole db provider sqlncli10 for linked server was unable to begin a distributed transaction.00000110 oledb provider for linked server returned message the partner transaction manager has disabled its support for remote/network transactions. I can able to execute the stored procedure in sql server but when i run the web page getting error like above. I did all the configuration. what is the solution?

2180


What is microsoft windows sharepoint services?

763


Explain about asp.net 2.0 themes?

729


What is globalization and localization in asp net?

707


what is silver light when will we use silver light,

1665


What can we do with asp.net?

688


Explain the difference between server control and html control.

690


What are the different web pages?

668


where can i gather the materials for MCP certification

4837