Web controls like Repeater and GridView respond to the ItemCommand event, but only for "buttons" (Button, ImageButton and LinkButton).
I'm developing a custom control derived from DropDownList that implements IButtonControl. No problem with this, but the Repeater control does not acknowledge of the Command event raised in my control.
The question: how can I make that the Repeter control looks for a Command event in my custom control? It seems to check only for Button, ImageButton and LinkButton controls.
But with a simpler approach, if you have a standard DropDownList on GridViewRow, you can get to the row in DropDownList's SelectedIndexChanged event via DropDownList's NamingContainer property. And when you get the row, you can get the row index and again
data key values etc and then do what you need and can do. That wouldn't require a custom control. For example:
http://forums.asp.net/1175178/ShowPost.aspx
epinaud
Member
5 Points
1 Post
Custom Control derived from IButtonControl
Jan 19, 2006 11:13 PM|LINK
Hello everybody,
Web controls like Repeater and GridView respond to the ItemCommand event, but only for "buttons" (Button, ImageButton and LinkButton).
I'm developing a custom control derived from DropDownList that implements IButtonControl. No problem with this, but the Repeater control does not acknowledge of the Command event raised in my control.
The question: how can I make that the Repeter control looks for a Command event in my custom control? It seems to check only for Button, ImageButton and LinkButton controls.
Thanks in advance,
Enrique.
Developer
joteke
All-Star
46284 Points
6896 Posts
ASPInsiders
MVP
Re: Custom Control derived from IButtonControl
Jan 21, 2006 12:12 PM|LINK
Hi,
I responded to your question with a blog post
How to develop a command-capable DropDownList
http://aspadvice.com/blogs/joteke/archive/2006/01/21/14794.aspx
But with a simpler approach, if you have a standard DropDownList on GridViewRow, you can get to the row in DropDownList's SelectedIndexChanged event via DropDownList's NamingContainer property. And when you get the row, you can get the row index and again data key values etc and then do what you need and can do. That wouldn't require a custom control. For example: http://forums.asp.net/1175178/ShowPost.aspx
Anyways, hope this helps
Teemu Keiski
Finland, EU