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



One Listbox showing all cities. If you select one city in list box the information related to that ..

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

One Listbox showing all cities. If you select one city in list box the information related to that ..

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

One Listbox showing all cities. If you select one city in list box the information related to that ..

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

Post New Answer

More ASP.NET Interview Questions

What are the intrinsic objects present in ASP.NET

1 Answers   IBM,


Define web services in asp.net.

0 Answers  


How does cookies work in asp net?

0 Answers  


What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?

1 Answers   Siebel,


what is difference between User Control,Custom Contro1,Web server control and template controls

1 Answers  






Which method is used to perform all validation at the page level?

0 Answers   Sans Pareil IT Services,


Fetch one page value to another page without using state-managment ?

0 Answers   HCL,


Which object wraps the state or data of a user?

0 Answers  


What is break mode?

0 Answers  


What is the difference between Session and response.Redirect?

0 Answers   Microsoft,


Why do we need master page in asp.net?

0 Answers  


What is the difference between managed and unmanaged code? *******

2 Answers   Patni,


Categories