By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,246 Members | 2,170 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,246 IT Pros & Developers. It's quick & easy.

Button event in DataList

P: n/a
I have a Button in a DataList Footer. I add the click event like this:

void Item_DataBound(Object sender, DataListItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Footer)
{
Button ctlSave = (Button)e.Item.FindControl("ctlSave");
ctlSave.Click += new EventHandler(ctlSave_Click);
}
}

It seems that the ctlSave_Click method is never called though. Am I doing
this right?
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

you'd need to wire this event in ItemCreated. I don't think the code ever
reaches Footer in ItemDataBound as footer isn't bindable item by default. In
ItemCreated Footer is always accessed (Footer item created), so that way it
should work.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"David W. Simmonds" <da***@simmonds.ca> wrote in message
news:PVuZb.580343$ts4.375490@pd7tw3no...
I have a Button in a DataList Footer. I add the click event like this:

void Item_DataBound(Object sender, DataListItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Footer)
{
Button ctlSave = (Button)e.Item.FindControl("ctlSave");
ctlSave.Click += new EventHandler(ctlSave_Click);
}
}

It seems that the ctlSave_Click method is never called though. Am I doing
this right?

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.