M
MattB
I have a button column in a datagrid that is the delete button. Right
now it is just a text link. When I go into the Property Builder My
button choices are only LinkButton or PushButton. I'd like it to be an
ImageButton so I tried converting the column to a Template Column.
Then I edited the template to change the LinkButton to an ImageButton
and replaced the text property with ans ImageURL property.
The Datagrid looks how I wanted it with the graphic in place, but the
delete command no longer seems to fire when I click on it.
So I changed this working code:
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton runat="server" Text="Delete" CommandName="Delete"
CausesValidation="false"></asp:LinkButton>
</ItemTemplate> </asp:TemplateColumn>
To this:
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton runat="server" ImageURL="images/test.gif"
CommandName="Delete" CausesValidation="false"></asp:ImageButton>
</ItemTemplate> </asp:TemplateColumn>
And now I can see it causes a postback but the Delete Command does not
fire. What am I missing? Thanks!
Matt
now it is just a text link. When I go into the Property Builder My
button choices are only LinkButton or PushButton. I'd like it to be an
ImageButton so I tried converting the column to a Template Column.
Then I edited the template to change the LinkButton to an ImageButton
and replaced the text property with ans ImageURL property.
The Datagrid looks how I wanted it with the graphic in place, but the
delete command no longer seems to fire when I click on it.
So I changed this working code:
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton runat="server" Text="Delete" CommandName="Delete"
CausesValidation="false"></asp:LinkButton>
</ItemTemplate> </asp:TemplateColumn>
To this:
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton runat="server" ImageURL="images/test.gif"
CommandName="Delete" CausesValidation="false"></asp:ImageButton>
</ItemTemplate> </asp:TemplateColumn>
And now I can see it causes a postback but the Delete Command does not
fire. What am I missing? Thanks!
Matt