A
angus
Dear all,
I know that i can add a button with oncommand event "ImageButton_Command" by
using the asp:ImageButton tag in the aspx code.
<asp:ImageButton id="imagebutton1" runat="server"
AlternateText="Sort Ascending"
ImageUrl="images/pict.jpg"
OnCommand="ImageButton_Command"
CommandName="Sort"
CommandArgument="Ascending"/>
But i have problem if i add that button in the codebehind,
Protected WithEvents imagebutton1As System.Web.UI.WebControls.ImageButton
ibtnSetup = New ImageButton
ibtnSetup.ImageUrl() = "icon-setup.gif"
ibtnSetup.CausesValidation = False
ibtnSetup.CommandArgument = drRack.Item("LOCATION_ID")
Protected Sub ibtnSetup_Click(ByVal sender As Object, ByVal e As
CommandEventArgs) Handles ibtnSetup.Command
Console.Write(e.CommandArgument)
End Sub
However, i cannot fire the event by adding the button in the codebehind,
what's wrong with that?
Thank you for your advices.
Regards,
Angus
I know that i can add a button with oncommand event "ImageButton_Command" by
using the asp:ImageButton tag in the aspx code.
<asp:ImageButton id="imagebutton1" runat="server"
AlternateText="Sort Ascending"
ImageUrl="images/pict.jpg"
OnCommand="ImageButton_Command"
CommandName="Sort"
CommandArgument="Ascending"/>
But i have problem if i add that button in the codebehind,
Protected WithEvents imagebutton1As System.Web.UI.WebControls.ImageButton
ibtnSetup = New ImageButton
ibtnSetup.ImageUrl() = "icon-setup.gif"
ibtnSetup.CausesValidation = False
ibtnSetup.CommandArgument = drRack.Item("LOCATION_ID")
Protected Sub ibtnSetup_Click(ByVal sender As Object, ByVal e As
CommandEventArgs) Handles ibtnSetup.Command
Console.Write(e.CommandArgument)
End Sub
However, i cannot fire the event by adding the button in the codebehind,
what's wrong with that?
Thank you for your advices.
Regards,
Angus