0

If i use a standard web form with no master page the following code works fine, when I add it to my master page it will not fire the events. Please advise.

Markup:

<asp:GridView ID="gvHR" CssClass="gridview" runat="server" AllowPaging="True"   
              EnableViewState="true"   DataKeyNames="HRID" 
              AutoGenerateColumns="False" DataSourceID="ldsHR"               >
              <Columns>
                  <asp:BoundField DataField="FirstName" HeaderText="FirstName" ReadOnly="True" 
                      SortExpression="FirstName" />
                  <asp:BoundField DataField="LastName" HeaderText="LastName" ReadOnly="True" 
                      SortExpression="LastName" />
                  <asp:BoundField DataField="EmailName" HeaderText="EmailName" ReadOnly="True" 
                      SortExpression="EmailName" />
                  <asp:TemplateField HeaderText="LeftCompany" SortExpression="LeftCompany">
                      <ItemTemplate>
                          <asp:CheckBox ID="CheckBox1" runat="server"  AutoPostBack="true"   OnCheckedChanged="chkchng"
                              Checked='<%# Bind("LeftCompany") %>' Enabled="true" />
                      </ItemTemplate>
                  </asp:TemplateField>
              </Columns>
          </asp:GridView>

Relevant Code Behind.

Public Sub chkchng(ByVal sender As Object, ByVal e As EventArgs)
        Dim gr As GridViewRow = CType(CType(sender, CheckBox).NamingContainer, GridViewRow)
        gvHR.UpdateRow(gr.RowIndex, True)
        gvHR.DataBind()
    End Sub
1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by MichaelWClark
0
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        gvHR.DataBind()
    End Sub

-Solved

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.