Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Get WebGridView row from dropdownlist selectedindexchanged
posted

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> 

 

Parents Reply Children
No Data