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 different ways of processing data in ASP page in the server side (like Forms, QueryStrings etc)?

1 Answers  


What is session handling in a webfarm, how it can work with its limits?

0 Answers   Siebel,


What ?ll u do in early and late binding ?

1 Answers   DELL,


i want the asp.net technical questions and answeres

0 Answers  


Compare and contrast between inline and code behind - which one is best?

2 Answers   Siebel,






How many types of web application ?

1 Answers  


Explain program to call the js function when the change is being made in the dropdown list made in asp.net mvc? : asp.net mvc

0 Answers  


Which of the following hosts Can't be used to create .net Application? a) IIS b) Internet Explorer c) ASP.Net d) Windows Shell Which one is correct?

1 Answers   CTS, TCS,


Explain the reason why the javascript validation not run on the asp.net button but run successfully on the html button?

0 Answers  


How does session work?

0 Answers  


What language is asp.net written in?

0 Answers  


What does the "EnableViewState" property do? Why would I want it on or off?

2 Answers   Photon Infotech, Siebel Systems, Syntax Softtech,


Categories