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

any body help me. Is it possible to convert text in gif images into word document with the same text? thanks in advance.

2 Answers  


In what order do the events of an ASPX page execute. As a developer, why is it important to understand these events?

5 Answers   Syntax Softtech, TCS,


How do you manage session in ASP and ASP.NET?

1 Answers   Microsoft,


What is custom tag in Web.Config?

0 Answers   Accenture,


what is difference between const, static and readonly?

2 Answers   TVS,






Types of caching. How to implement caching?

2 Answers   Microsoft,


What are the asp.net objects? is it application obects, cache objests etc. or is it state managements, web services etc?

3 Answers   Syntel,


What are the different types of Session state management options available with ASP.NET?

5 Answers   Siebel Systems,


Explain page output caching?

0 Answers  


How tooltip is set through code-behind in ASP.NET?

0 Answers  


Where sessions are stored in asp.net?

0 Answers  


What?s a bubbled event?

6 Answers   Visual Soft,


Categories