I am trying to create a user control to wrap around the Membership API (A set of custom Gridviews to display the data better) and, while the code and the controls worked fine in the page, when I moved them to an .ascx, the events stopped firing to it.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CustomMembership.ascx.cs" Inherits="CCGlink.CustomMembership" %>
<asp:Panel ID="mainPnl" runat="server">
<asp:Label
id="lblError"
ForeColor="Red"
Font-Bold="true"
runat="server" />
<asp:GridView
id="grdUsers"
HeaderStyle-cssclass="<%# _headercss %>"
RowStyle-cssclass="<%# _rowcss %>"
AlternatingRowStyle-cssclass="<%# _alternatingcss %>"
OnRowUpdating="grdUsers_RowUpdating"
OnRowDeleting="grdUsers_RowDeleting"
OnRowCancelingEdit="grdUsers_cancelEdit"
autogeneratecolumns="false"
allowsorting="true"
AllowPaging="true"
EmptyDataText="No users..."
pagesize="<%# PageSizeForBoth %>"
runat="server">
<!-- ...columns... -->
</asp:GridView>
<asp:Button
id="btnAllDetails"
onclick="btnAllDetails_clicked"
text="Full Info"
runat="server" />
<asp:GridView
DataKeyNames="UserName"
HeaderStyle-cssclass="<%# _headercss %>"
RowStyle-cssclass="<%# _rowcss %>"
AlternatingRowStyle-cssclass="<%# _alternatingcss %>"
id="grdAllDetails"
visible="false"
allowsorting="true"
EmptyDataText="No users in DB."
pagesize="<%# PageSizeForBoth %>"
runat="server" />
<asp:Button
id="btnDoneAllDetails"
onclick="btnAllDetails_clicked"
text="Done."
Visible="false"
runat="server" />
</asp:Panel>
However, none of the events in the first two controls (the gridview grdUsers and the button btnAllDetails) simply do NOT occur, I have verified this in the debugger. If they occured just fine in the aspx page, why do they die on moving to the ascx?
My code in the aspx now is:
<div class="admin-right">
<asp:ScriptManager ID="sm1" runat="server" />
<h1>User Management</h1>
<div class="admin-right-users">
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<cm1:CustomMembership
id="showUsers"
PageSizeForBoth="9"
AlternatingRowStylecssclass="alternating"
RowStylecssclass="row"
DataSource="srcUsers"
HeaderStylecssclass="header"
runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
Thanks.