G
Guest
This should be relatively simple but I am unable to find an asp:button tag in
a datalist footer. I have tried it numerous ways including the FindControl
method from the many events that the DataList exposes and the result is
always null (I've determined the OnItemDataBound event will not find the
footer controls). I understand that I have to navigate the datalist object
tree, but I feel like it is a guessing game and am hesitant to do it that way
since it will break when new controls are added to the datalist down the
road. Following is my aspx code:
<asp:datalist id="dlUnSelected" Runat="server" Width="880"
CssClass="DataListStyle">
<HeaderTemplate>
<tr bgColor="#3342b5">
<td class="zz" colspan="20" align="left" height="28"><b><font size="2"
color="#ffffff"><%# ProductID_Desc%> Rules: Available for
Selection</font></b></td>
</tr>
<tr vAlign="top" align=right bgColor="#d3d3d3">
<td class="dataheader" align="center" width="5" title="Row Number">#</td>
<td class="dataheader" align="center" width="5"></td>
<td class="dataheader" align="left" width="250" title="Rule
Description">RuleDesc</td>
<td class="dataheader" align="center" width="75" title="LookBack">LB</td>
<td class="dataheader" align="center" width="75" title="Guardian
Age">GA</td>
<td class="dataheader" align="center" width="250" title="Mail Age
Exclusion">Mail Age Exclusion</td>
<td class="dataheader" align="center" width="75" title="Mail Age
Minimum">Age1</td>
<td class="dataheader" align="center" width="75" title="Mail Age
Maximum">Age2</td>
<td class="dataheader" align="center" width="75" title="Rollup
Description">RollupDesc</td>
<td class="dataheader" align="center" width="100" title="Rollup
Minimum">RMN</td>
<td class="dataheader" align="center" width="100" title="Rollup
Maximum">RMX</td>
<td class="dataheader" align="center" width="75" title="Mail Limit">ML</td>
<td class="dataheader" align="center" width="75" title="Retail
Limit">RL</td>
<td class="dataheader" align="center" width="200" title="Rule
Exclusion">Rule Exclusion</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr id="trSelected" vAlign="center" align=right bgColor=#f5f5f5
runat="server">
<td class="data" align=left width="5"><%=CounterS%>.</td>
<td class="data" align=left width="5">
<asp:CheckBox ID="chkBox_U" AutoPostBack="False"
Runat="server"></asp:CheckBox>
<input NAME="ruleID_U" type="hidden" id="ruleID_U" value='<%#
DataBinder.Eval(Container.DataItem, "rule_id")%>' runat="server">
<input NAME="ruleDesc_U" type="hidden" id="ruleDesc_U" value='<%#
DataBinder.Eval(Container.DataItem, "description_rule_id")%>'
runat="server">
</td>
<td class="data" align="left" width="250" title="No Rule Description"><%#
(DataBinder.Eval(Container.DataItem,
"description_rule_id")).ToString().ToUpper()%></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtLB_U"
Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "lookback")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtGA_U"
Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "guardian_age")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="250">
<aspropDownList ID="ddlMailAgeVerbose_U" AutoPostBack="False"
Runat="server">
<asp:ListItem Selected Value="0">Select Range</asp:ListItem>
<asp:ListItem Value="1">If Under Age1:</asp:ListItem>
<asp:ListItem Value="2">If Over Age2:</asp:ListItem>
<asp:ListItem Value="3">If Between Age1 and Age2:</asp:ListItem>
<asp:ListItem Value="4">If Over Age1 or Under Age2:</asp:ListItem>
</aspropDownList>
</td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtMAMIN_U"
Enabled="False" Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "mail_age_min")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtMAMAX_U"
Enabled="False" Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "mail_age_max")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><%#
DataBinder.Eval(Container.DataItem, "rollup_description")%></td>
<td class="data" align="center" width="100"><asp:TextBox ID="txtRUMIN_U"
Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "rollup_min")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="100"><asp:TextBox ID="txtRUMAX_U"
Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "rollup_max")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtML_U"
Width="30" style="text-align:right" Enabled="False" Text='<%#
DataBinder.Eval(Container.DataItem, "mail_limit")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtRL_U"
Width="30" style="text-align:right" Enabled="False" Text='<%#
DataBinder.Eval(Container.DataItem, "retail_limit")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="200">
<aspropDownList ID="ddlRuleExclusions_U"
Runat="server"></aspropDownList>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr vAlign="center" align=right bgColor="dcdcdc" height="28">
<td colspan="20" align="center"><asp:Button ID="btnSubmit_U"
OnClick="btnSubmit_U_Click" Text="Add Rules" CssClass="graygobtn"
Runat="server"></asp:Button></td>
</tr>
</FooterTemplate>
</asp:datalist>
a datalist footer. I have tried it numerous ways including the FindControl
method from the many events that the DataList exposes and the result is
always null (I've determined the OnItemDataBound event will not find the
footer controls). I understand that I have to navigate the datalist object
tree, but I feel like it is a guessing game and am hesitant to do it that way
since it will break when new controls are added to the datalist down the
road. Following is my aspx code:
<asp:datalist id="dlUnSelected" Runat="server" Width="880"
CssClass="DataListStyle">
<HeaderTemplate>
<tr bgColor="#3342b5">
<td class="zz" colspan="20" align="left" height="28"><b><font size="2"
color="#ffffff"><%# ProductID_Desc%> Rules: Available for
Selection</font></b></td>
</tr>
<tr vAlign="top" align=right bgColor="#d3d3d3">
<td class="dataheader" align="center" width="5" title="Row Number">#</td>
<td class="dataheader" align="center" width="5"></td>
<td class="dataheader" align="left" width="250" title="Rule
Description">RuleDesc</td>
<td class="dataheader" align="center" width="75" title="LookBack">LB</td>
<td class="dataheader" align="center" width="75" title="Guardian
Age">GA</td>
<td class="dataheader" align="center" width="250" title="Mail Age
Exclusion">Mail Age Exclusion</td>
<td class="dataheader" align="center" width="75" title="Mail Age
Minimum">Age1</td>
<td class="dataheader" align="center" width="75" title="Mail Age
Maximum">Age2</td>
<td class="dataheader" align="center" width="75" title="Rollup
Description">RollupDesc</td>
<td class="dataheader" align="center" width="100" title="Rollup
Minimum">RMN</td>
<td class="dataheader" align="center" width="100" title="Rollup
Maximum">RMX</td>
<td class="dataheader" align="center" width="75" title="Mail Limit">ML</td>
<td class="dataheader" align="center" width="75" title="Retail
Limit">RL</td>
<td class="dataheader" align="center" width="200" title="Rule
Exclusion">Rule Exclusion</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr id="trSelected" vAlign="center" align=right bgColor=#f5f5f5
runat="server">
<td class="data" align=left width="5"><%=CounterS%>.</td>
<td class="data" align=left width="5">
<asp:CheckBox ID="chkBox_U" AutoPostBack="False"
Runat="server"></asp:CheckBox>
<input NAME="ruleID_U" type="hidden" id="ruleID_U" value='<%#
DataBinder.Eval(Container.DataItem, "rule_id")%>' runat="server">
<input NAME="ruleDesc_U" type="hidden" id="ruleDesc_U" value='<%#
DataBinder.Eval(Container.DataItem, "description_rule_id")%>'
runat="server">
</td>
<td class="data" align="left" width="250" title="No Rule Description"><%#
(DataBinder.Eval(Container.DataItem,
"description_rule_id")).ToString().ToUpper()%></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtLB_U"
Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "lookback")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtGA_U"
Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "guardian_age")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="250">
<aspropDownList ID="ddlMailAgeVerbose_U" AutoPostBack="False"
Runat="server">
<asp:ListItem Selected Value="0">Select Range</asp:ListItem>
<asp:ListItem Value="1">If Under Age1:</asp:ListItem>
<asp:ListItem Value="2">If Over Age2:</asp:ListItem>
<asp:ListItem Value="3">If Between Age1 and Age2:</asp:ListItem>
<asp:ListItem Value="4">If Over Age1 or Under Age2:</asp:ListItem>
</aspropDownList>
</td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtMAMIN_U"
Enabled="False" Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "mail_age_min")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtMAMAX_U"
Enabled="False" Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "mail_age_max")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><%#
DataBinder.Eval(Container.DataItem, "rollup_description")%></td>
<td class="data" align="center" width="100"><asp:TextBox ID="txtRUMIN_U"
Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "rollup_min")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="100"><asp:TextBox ID="txtRUMAX_U"
Width="30" style="text-align:right" Text='<%#
DataBinder.Eval(Container.DataItem, "rollup_max")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtML_U"
Width="30" style="text-align:right" Enabled="False" Text='<%#
DataBinder.Eval(Container.DataItem, "mail_limit")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="75"><asp:TextBox ID="txtRL_U"
Width="30" style="text-align:right" Enabled="False" Text='<%#
DataBinder.Eval(Container.DataItem, "retail_limit")%>'
Runat="server"></asp:TextBox></td>
<td class="data" align="center" width="200">
<aspropDownList ID="ddlRuleExclusions_U"
Runat="server"></aspropDownList>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr vAlign="center" align=right bgColor="dcdcdc" height="28">
<td colspan="20" align="center"><asp:Button ID="btnSubmit_U"
OnClick="btnSubmit_U_Click" Text="Add Rules" CssClass="graygobtn"
Runat="server"></asp:Button></td>
</tr>
</FooterTemplate>
</asp:datalist>