Wednesday, August 11, 2010

How to filter the datas in second combobox with respect to first combobox in datagrid in asp.net ?

filter the datas in second combobox with respect to first combobox in datagrid in asp.net .I want the apt coding..How to filter the datas in second combobox with respect to first combobox in datagrid in asp.net ?
Since both dropDownLists are in the DataGird, this will complicate things a little bit.





Usually what you want do do is set the AutoPostBack property of the first DropDownList to true. You fill the Items of the 2nd DropDownList while handling the OnSelectedIndexChanged of the 1st DropDownList.





Since this is the case of a DataGrid, You have to add the first DropDownList in an %26lt;ItemTemplate%26gt; of an asp:TemplateColumn.





On the ItemDataBound event handler of the DataGrid, you should fill the Items of each DropDownList1 and wire the event OnSelectedIndexChanged of the DropDownList1 (which will be repeated for every record in your DataGrid).





The last Step is to define the event handler for the OnSelectedIndexChanged of DropDownList1.





My answer is a little bit vague since it doesn't contain actual code, but it draws the outline which you should follow to reach your goal.





Hope this helps.

No comments:

Post a Comment