imagebutton not responding
|
Hey guys,
Okay I've stared at this code for ages and I'm obviously missing something. I have a Gridview with an imagebutton in it. If I use a buttonfield it responds in the rowcommand no problem at all but for some reason the imagebutton doesn't.
ASP bit
HTML Code:
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="btnBid" runat="server" CommandArgument='<%#EVAL("pro_id") %>' CommandName="place_bid" Visible="false" ImageUrl="~/pics/bid.png" />
<asp:ImageButton ID="btnBuy" runat="server" CommandArgument='<%#EVAL("pro_id") %>' CommandName="Add" Visible="false" ImageUrl="~/pics/buy.png" />
</ItemTemplate>
</asp:TemplateField>
Code behind bit (ignore the stupid code it's just to test if it's working)
Code:
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
If e.CommandName = "Add" Then
Me.Label12.Text = e.CommandArgument.ToString
else me.Label12.Text = "wth"
End If
End Sub
The visible bit is because it determines which button to show based on the database, this is the reason I went with the imagebutton because I couldn't figure out how to toggle visibility with the buttonfield. For the record changing visibility in the code itself has no impact on the result.
What the heck am I missing? >.<
|
__________________
I have learned more about VB from this forum in 3 months than I learned alone in 1 year. Share your knowledge and learn from others ;)
|