Code:
<asp:gridview id="GridViewLookupCodes" runat="server" allowpaging="True" allowsorting="True" autogeneratecolumns="False" cssclass="GridViewGrid" datakeynames="LKUPiID" pagersettings-mode="NextPreviousFirstLast" pagersettings-firstpagetext="First" pagersettings-lastpagetext="Last" pagersettings-nextpagetext="Next" pagersettings-previouspagetext="Previous" pagersettings-pagebuttoncount="10">
<columns>
<asp:templatefield showheader="False">
<itemstyle verticalalign="Top" />
<headertemplate>
<asp:linkbutton id="LinkButtonAddNew" runat="server" commandname="Insert" text="Insert"></asp:linkbutton>
</headertemplate>
<itemtemplate>
<asp:linkbutton id="LinkButtonEdit" runat="server" causesvalidation="false" commandname="Edit" text="Edit"></asp:linkbutton>
<asp:linkbutton id="LinkButtonDelete" runat="server" causesvalidation="false" commandname="Delete" onclientclick="return confirm('Are you sure you want to delete this record?')" text="Delete"></asp:linkbutton>
</itemtemplate>
<edititemtemplate>
<asp:linkbutton id="LinkButtonUpdate" runat="server" commandname="Update" text="Update"></asp:linkbutton>
<asp:linkbutton id="LinkButtonCancel" runat="server" causesvalidation="false" commandname="Cancel" text="Cancel" onclientclick="return confirm('You clicked cancel')"></asp:linkbutton>
</edititemtemplate>
<footertemplate>
<asp:linkbutton id="LinkButtonUpdateNew" runat="server" commandname="UpdateNew" text="Update"></asp:linkbutton>
<asp:linkbutton id="LinkButtonCancelNew" runat="server" causesvalidation="false" commandname="CancelNew" text="Cancel"></asp:linkbutton>
</footertemplate>
</asp:templatefield>
continued...
protected override void OnInit(EventArgs e)
{
GridViewLookupCodes.PageIndexChanging += new GridViewPageEventHandler(GridViewLookupCodes_PageIndexChanging);
GridViewLookupCodes.Sorting += new GridViewSortEventHandler(GridViewLookupCodes_Sorting);
GridViewLookupCodes.RowCommand += new GridViewCommandEventHandler(GridViewLookupCodes_RowCommand);
GridViewLookupCodes.RowCancelingEdit += new GridViewCancelEditEventHandler(GridViewLookupCodes_RowCancelingEdit);
GridViewLookupCodes.RowEditing += new GridViewEditEventHandler(GridViewLookupCodes_RowEditing);
GridViewLookupCodes.RowDeleting += new GridViewDeleteEventHandler(GridViewLookupCodes_RowDeleting);
GridViewLookupCodes.RowUpdating += new GridViewUpdateEventHandler(GridViewLookupCodes_RowUpdating);
base.OnInit(e);
}
//Two that don't work...
protected void GridViewLookupCodes_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
if (UpdateRow(e))
{
GridViewLookupCodes.EditIndex = -1;
LoadGrid();
}
}
protected void GridViewLookupCodes_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridViewLookupCodes.EditIndex = -1;
LoadGrid();
}
Page directive autoeventwireup="false" - when it was true the rowcommand wasn't running for anything but paging and sorting. The Cancel does take away the textboxes but doesn't reload the grid. I placed breakpoints at each of these as well as the RowCommand and it never hits any of them. The ones in the header, item and footer all work properly...
Hope everyone is having a great day!
Thanks - Jennifer