okay so in a typical gridview (Microsoft ASP.net one) you can put a drop down list in a template column, then in the selectedindexchanged event you can type this
Protected Sub ddl_PackWeek_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim gd_data1 As New DataAccessLayer() 'get dropdownlist object Dim Myddl As DropDownList = CType(sender, DropDownList) 'use naming container property to get the row in which the control resides Dim MyRow As GridViewRow = CType(Myddl.NamingContainer, GridViewRow) 'database call gd_data1.updatePackWeek(MyRow.Cells(0).Text, Myddl.SelectedItem.Value) Me.gv_receiving.DataBind() End Sub
How do you do this in a web grid view?
in so many words, how do I access info from the ROW of my Drop Down List?
ASP if you need it
<ig:TemplateDataField Header-Text ="Pack Type" key="BoxType2" Width="200px"> <ItemTemplate> <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddl_BoxesType2_SelectedIndexChanged" SelectedValue='<%# Bind("BoxType2")%>' DataSourceID="sqlBoxesType2" DataTextField="BoxType2_SN" DataValueField="RecID"> </asp:DropDownList> </ItemTemplat<Header Text="Pack Type"></Header> </ig:TemplateDataField>
Hello Roger,
You can see the following sample that demonstrates the Drop-Down Editors in WebDataGrid here.
You can check this help help topic as well.
You can find the row the drop-down belongs using SelectionChanged client event as described in that forum post:
You can find the row the drop-down belongs using SelectionChanged server event as described in that forum post:
Let me know if I may be of further assistance.
Svetla Boykova
Ok what about itemcommand ?