G
Guest
Hi,How can I access to checkbox control in footer template of datalist and fire the selectedchangeindex event?
fire the selectedchangeindex event?mahsa said:Hi,How can I access to checkbox control in footer template of datalist and
= DataList1.Controls[0].Controls.Count-1;mahsa said:hi I try this on DataList_ItemDataBound to find a control int footerIndex
DataList1.Controls[0].Controls[footerIndex].FindControl("Ch_LiftGround") asCheckBox d;
d =
if(d != null)
{
d.AutoPostBack=true;
d.CheckedChanged += new System.EventHandler(this.Ch_LiftGround_CheckedChanged);
}
but if the footer templete is not in item template like this:
<ItemTemplate>
<FooterTemplate>
<asp:CheckBox ID="Ch_LiftGround" Runat="server" Text="Lift Ground
work exacty right either do you have any idea?Service" class='caption' AutoPostBack=true > said:</FooterTemplate>
</ItemTemplate>
this code dosent work and if the footer is in daitemtemplate it dosent
Teemu Keiski said:Hi,
like I said in my previous post, you must do it in *ItemCreated* (it is
different than ItemDataBound). ItemDataBound is not called for footer (only
for normal and alternating items according to the rows in data source), and
it is called only when DataBind is called for the DataList. You need to get
the code to run on every request, and ItemCreated works exactly that way and
additionally ItemCreated is called for the footer as well (DataListItem's
ItemType in ItemCreated is Footer then)
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
= DataList1.Controls[0].Controls.Count-1;mahsa said:hi I try this on DataList_ItemDataBound to find a control int footerIndexDataList1.Controls[0].Controls[footerIndex].FindControl("Ch_LiftGround") asCheckBox d;
d =
CheckBox;if(d != null)
{
d.AutoPostBack=true;
d.CheckedChanged += new System.EventHandler(this.Ch_LiftGround_CheckedChanged);
}
but if the footer templete is not in item template like this:
<ItemTemplate>
<FooterTemplate>
<asp:CheckBox ID="Ch_LiftGround" Runat="server" Text="Lift Groundwork exacty right either do you have any idea?Service" class='caption' AutoPostBack=true > said:</FooterTemplate>
</ItemTemplate>
this code dosent work and if the footer is in daitemtemplate it dosent
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.