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 |
What are the two properties that are common on every validation control?
What is odata in web api?
# What is the transport protocol you use to call a Web service?
Whta are the Various steps taken to optimize a web based application (caching, stored procedure etc.) ?
Define the types of configuration files.
What is the difference between executescalar and executenonquery?
Does JITting occur per-assembly or per-method? How does this affect the working set?
Where do you store the information about the user?s locale?
Write a code for passing ArrayList in Web API?
When a dropdownlist has been added by some records and it has been binded why it is not executing i'm facing this error pls help me ? if (is!pageposback) { arraylist books = new arraylist; books.add ("gone with the wind"); books.add ("rahulsriramprakash"); books.add ("vishal"); dropdowndisplay.datasource=books; dropdowndisplay.databind(); } The error is : 1) The dropdowndisplay does not exist.
Define static member?
What is the difference between HTTP-Post and HTTP-Get ?