Fill Combobox of Gridview
Code:
<asp:GridView ID="Grdview1" runat="server"
AutoGenerateColumns="False"
AllowPaging ="false" Width="100%"
>
<Columns>
<asp:TemplateField HeaderText="Cities">
<ItemTemplate >
<asp:DropDownList ID="cmb1" runat="server" >
<asp:ListItem Value="--Select--" Text="--Select--"></asp:ListItem>
<asp:ListItem Value="Faridabad" Text="Faridabad"></asp:ListItem>
<asp:ListItem Value="Delhi" Text="Delhi"></asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Addresses">
<ItemTemplate >
<asp:DropDownList ID="cmb2" runat="server" >
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I have two comboxes in GridView named cmb1 & cmb2. On selection Changed of cmb1,I want that cmb2 items to be fill from the database.
How to do dat? I have no idea how to do it. Plz help me!!!!
Thx in advance.
Re: Fill Combobox of Gridview
Hello,
Have a look here for a walkthrough on how this can be achieved:
http://www.asp.net/data-access/tutor...opdownlists-cs
If you are using AJAX, you have the option of using this:
http://www.asp.net/ajax/ajaxcontrolt...gDropDown.aspx
Hope that helps!
Gary
Re: Fill Combobox of Gridview
hi Gep,My Comboboxes is in Gridview..not on form.
Re: Fill Combobox of Gridview
That really doesn't matter. You would still apply the same technique.
Gary