datagrid buttoncolumn

P

Phil Townsend

I have placed a buttoncolumn into a datagrid, but it does not seem to
raise any event when clicked. It should be firing the ItemCommand event,
right? There is an appropriate event handler registered for the
ItemCommand yet the button in the buttoncolumn does nothing wehn
clicked. Any reasons why this might be happening? Thanks!
 
S

spidur1

Actually the item command is for an item in a template column. If you
added a delete button it would that datagrid.deletecommand. An edit
button would be the datagrid.edit command.

What I usually do is add a button in a template column and set the
property of the command name to "MyCommand" then add the following to
your code behind page

Private Sub MyCommandClick(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
dgRenew.ItemCommand
If e.CommandName = "MyCommmand" Then
'PUT CODE HERE
End If
End Sub
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top