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
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        gvHR.DataBind()
    End Sub

-Solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.