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?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / sathish
On select change event of the list box use the following code.
Dim con as new sqlconn("connectionstring")
con.open()
dim da as sqlda("select * from table where cityname=" &
listbox1.selecteditem)
dim ds as new dataset
da.fill(ds)
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / yogaraj i
protected void ddlcity_SelectedIndexChanged(object sender,
EventArgs e)
{
if (ddlcity.SelectedValue == "Any of the city name")
{
DataSet ds = GetUserInfo();
GridviewCitycity.DataSource = ds;
GridviewCity.DataBind();
}
}
| Is This Answer Correct ? | 2 Yes | 4 No |
Which adapter should you use, if you want to get the data from an access database?
when the threads are used in dot net.
How do I force the dispose method to be called automatically, as clients can forget to call dispose method?
How ViewstateMac works?
Where do the cookie state and session state information be stored?
Is asp.net outdated?
Explain the difference between dataset and datareader.
How long do session variables last?
How can u debug your .net application?
Define static function?
Have you used microsoft dataaccess blocks and Exception blocks?
extensibility in asp.net2.0
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)