Home > Archive > ASP .NET > July 2005 > How can I add an event to a control in a templete column?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How can I add an event to a control in a templete column?
|
|
| basulasz 2005-07-29, 9:05 am |
| I have a templete column, and a DropDownList in header templete. I want to
add a SelectedIndexChanged event to that DropDownList. But I couldn't. How
can I do that?
Thanks...
--
No Sign
| |
|
| In your HTML for datagrid template, write ... <asp:DropDownList
OnSelectedIndexChanged="MyEvent"></asp:DropDownList>
In you code behind:
public void MyEvent(object source, System.EventArgs e)
{
// Handle your event here...
}
This technique is called event bubbling. Making the event handler's scope as
public is very important
--
Samba!
| |
| basulasz 2005-07-29, 9:05 am |
| This works well, thank you very much...
--
|
|
|
|
|