-----Original Message-----
Hi Ron,
You've got it. In the ItemCommand event, just check the CommandName to be
sure that's the button that was clicked:
Private Sub DataGrid1_ItemCommand _
(ByVal source As Object, _
ByVal e As System.Web.UI.WebControls. _
DataGridCommandEventArgs) _
Handles DataGrid1.ItemCommand
If e.CommandName = "Cmdimgbutton" Then
Response.Write("Clicked " & _
e.CommandName & " on row " & _
e.Item.ItemIndex.ToString)
End If
End Sub
You're on your way!
Ken
MVP [ASP.NET]
Thanks. That worked. I had a feeling it had something to
do with TemplateColumns. Inorder to get it to process the
command I want, just add the CommandName like such?
<asp:ImageButton id="ImageButton1" runat="server"
ImageUrl="../Graphics/help.gif"
-----Original Message-----
Hi Ron,
You could change the column to a template and then
insert
the image button
in place of the regular button. In the following, the first is a plain
button, the second uses a template with an image button.
<asp:ButtonColumn Text="Select" ButtonType="PushButton"
HeaderText="Plain button"
CommandName="Select"> said:
<asp:TemplateColumn HeaderText="Image button">
<ItemTemplate>
<asp:ImageButton id="ImageButton1" runat="server"
ImageUrl="
http://www.gc.ca/images/canada.gif"></asp:Imag
eB
utton>
</ItemTemplate>
</asp:TemplateColumn>
Does this help?
Ken
Microsoft MVP [ASP.NET]
I'm trying to add an ImageButton Column into my datagrid,
but the Property Designer only allows for plain buttons
and link buttons. Is there a way to use image buttons,so
this button matches the rest of the theme of my site?
Thanks!
.
.