Hyperlink column in dg not firing itemcommand event?

  • Thread starter Thread starter Karen
  • Start date Start date
K

Karen

Hi,

In one of our datagrids we have just added some hyperlinks. One is
plain, the other is a template control. Neither seems to fire the
itemcommand event when clicked. The handler is specified in the html
view, and we have buttons on the grid that do fire the event.

Is this normal that hyperlinks don't fire the itemcommand event?

Karen
 
Hi Karen,

The WebForm DataGrid's ItemCommand can be fired by Button control(with
certain CommandName set) only. Here is the description in MSDN:
========================
The ItemCommand event is raised when any button is clicked in the DataGrid
control. This event is commonly used to handle buttons controls with a
custom CommandName value, such as Add, in the DataGrid control.
========================
For more detailed info, please view the following reference:
#DataGrid.ItemCommand Event
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebuiwebcontro
lsdatagridclassitemcommandtopic.asp?frame=true

So I think we should use Some Button Controls if we'd like them to fire the
"ItemCommand" event. Maybe the LInkButton is the appropriate one.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Back
Top