Click here to Skip to main content
15,943,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

i have a dropdown list and one text box and one button now i want when i click a dropdown list and select a category so all the record shown against that id on another page for exampe default1.aspx how this possible.
DamithSL 9-May-14 13:37pm    
it is possible if you try to do it :)
Mian Sahib Jan 9-May-14 13:43pm    
sir i am trying but no idea come in my mind that how to i need your help plz
DamithSL 9-May-14 13:46pm    
update the question with your code, have you bind the droupdown?
Mian Sahib Jan 9-May-14 13:57pm    
yes i bind it my bind code are below and they fill but i want to serch i know how t access data through id but not know how to that data kept on another page actuly i mean when the text or id of dropdown list chnged and the get by this id and that data goes to another page abc etc and shown their because i take these control on master page which shown through out project
sir my englis are not soo good but i thing you understand my problem<br>
protected void Page_Load(object sender, EventArgs e)<br>
if (!IsPostBack)<br>
public void FillDLLCategory()<br>
if (!IsPostBack)<br>
ddlSerch.DataTextField = "CategoryName";<br>
ddlSerch.DataValueField = "CategoryId";<br>
DataSet ds = accMaster.getCategory();<br>
ddlSerch.DataSource = ds;<br>
ddlSerch.Items.Insert(0, "Select Category...");<br>

1 solution

you need to add selected index changed event to your ddlSerch. That event will fire when you change the category.

On that event, you need to select the CategoryId. ddlSerch.SelectedValue will give you the value member of selected item.
you can use several methods [^]to pass data between web pages. check below article for QueryString
Passing variables between pages using QueryString[^]

in your second page get the category id came as QueryString and load the data into gridview.

Study and do it your self. Good Luck :)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900