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

Whats the difference between registerclientscriptblock, registerclientscriptinclude and registerclientscriptresource?

1 Answers  


Explain the difference between response.redirect vs server.transfer

1 Answers  


What is FullTrust? Do GACed assemblies have FullTrust?

2 Answers  


Explain autherization levels in .net ?

2 Answers  


To display data in the combo box, prior to setting the Data Source, what kind of property on a Combo Box do you set with a column name?

1 Answers   Siebel,


Define an assembly?

9 Answers   Siebel,


I’m having some trouble with cas. How can I diagnose my problem?

1 Answers  


Explain the disadvantages of viewstate?

1 Answers  


what are partial classes and their use?

3 Answers   Microsoft,


Explain serialization and deserialization?

1 Answers  


What are the new features added from ASP to ASP.NET?

1 Answers   Amdocs,


What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

2 Answers  


Categories