Click here to Skip to main content
15,915,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello All,
I want to add dropdown filter in gridview.i googled a lot but all i got is that all are using a single table or columns are generated in code itself.

in my case,tables are changed on selecting the table name from a dropdownlist.so i can not make auto-generated-column on.

eg.

enter table name: movie/user

gridview contains : list of movies with different category or list of user with different columns.

plz help me.

have a lot of hope from you dot net masters:
SAKryukov
John Simmons
thatraja
OriginalGriff
Abhinav S
Mika Wendelius
Posted
Comments
Rajesh Anuhya 26-Dec-11 4:35am    
"have a lot of hope from you dot net masters:
SAKryukov
John Simmons
thatraja
OriginalGriff
Abhinav S
Mika Wendelius"
I am not going to take up this question.
Sanjeev236 26-Dec-11 4:41am    
Rajesh,
dnt take it otherwise dear..!!! actually i got a lot from answer from them.so i was looking for them to help me out.
and thr are a lot more genious over here,but these masters have answers for everythng. so go ahead n take the qns.

have a nice day..!

Try this url.....................http://forums.asp.net/t/1635589.aspx/1[^]
 
Share this answer
 
Hi ,

you can add DropDown in aspx code page:

<asp:dropdownlist id="DropDownList1" runat="server" xmlns:asp="#unknown">AutoPostBack="true" 
       onselectedindexchanged="DropDownList1_SelectedIndexChanged">
   </asp:dropdownlist>


Autopostback attribute make it true.

at C# code page

C#
protected void  DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    if (DropDownList1.SelectedItem != null )
    {
        string selectedtext = DropDownList1.SelectedItem.Text;
        string selectedValue = DropDownList1.SelectedItem.Value;

        // write your logic for bind gridview as per selected item.
    }
}


Please let me know is this helpful to you.
 
Share this answer
 
Comments
Sanjeev236 26-Dec-11 5:03am    
i need to add filter on the selected table from dropdownlist.
my problem is to add filter..not to bind data in gridview.
anyway thanx a lot.!!!!!! :)

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