how can I access to controls in footertemplate

G

Guest

Hi,How can I access to checkbox control in footer template of datalist and
fire the selectedchangeindex event?

I try this on DataList_ItemDataBound to find a control int footerIndex = DataList1.Controls[0].Controls.Count-1;
CheckBox d;
d = DataList1.Controls[0].Controls[footerIndex].FindControl("Ch_LiftGround") as 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 Ground Service" class='caption' AutoPostBack=true ></asp:CheckBox>
</FooterTemplate>
</ItemTemplate>
this code dosent work and if the footer is in daitemtemplate it dosent work exacty right either do you have any idea?


 

Ask a Question

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.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top