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 4 1853
you need to add this event handler..
this.ImageButton1.Click += new
System.Web.UI.ImageClickEventHandler(this.ibtnSetu p_Click);
Av.
"angus" <an***@angus.com> wrote in message
news:eD**************@TK2MSFTNGP11.phx.gbl... 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 am using VB.net this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ibtnSetu p_Click);
i know that i have to use above statement if i am using c#.
what if VB.net?
"avnrao" <av*@newsgroups.com> wrote in message
news:Oe**************@TK2MSFTNGP12.phx.gbl... you need to add this event handler..
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ibtnSetu p_Click);
Av.
"angus" <an***@angus.com> wrote in message news:eD**************@TK2MSFTNGP11.phx.gbl... 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
AddHandler ImageButton1.Click, AddressOf ibtnSetup_Click
Av.
"Harry" <ha******@mail.hongkong.com> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl... i am using VB.net
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ibtnSetu p_Click);
i know that i have to use above statement if i am using c#.
what if VB.net?
"avnrao" <av*@newsgroups.com> wrote in message news:Oe**************@TK2MSFTNGP12.phx.gbl... you need to add this event handler..
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ibtnSetu p_Click);
Av.
"angus" <an***@angus.com> wrote in message news:eD**************@TK2MSFTNGP11.phx.gbl... > 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 > >
got it....thank you so much.
"avnrao" <av*@newsgroups.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... AddHandler ImageButton1.Click, AddressOf ibtnSetup_Click
Av.
"Harry" <ha******@mail.hongkong.com> wrote in message news:eq**************@TK2MSFTNGP12.phx.gbl...i am using VB.net
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ibtnSetu p_Click);
i know that i have to use above statement if i am using c#.
what if VB.net?
"avnrao" <av*@newsgroups.com> wrote in message news:Oe**************@TK2MSFTNGP12.phx.gbl... you need to add this event handler..
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ibtnSetu p_Click);
Av.
"angus" <an***@angus.com> wrote in message news:eD**************@TK2MSFTNGP11.phx.gbl... > 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 > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Chuck Hartman |
last post by:
I've been trying to add an ImageButton object to a Calendar table cell, but
so far I am unable to handle the Command event from that button in my form's
code behind. Below is an example of what I...
|
by: J McD |
last post by:
Hi
I have a DataGrid with an ImageButton column. When I click on an imagebutton I get a postback but it doesn't run the OnImgBtnClick method. I can actually comment out the line where I add this...
|
by: Henke |
last post by:
Hello,
I have one ImageButton controls which I initialize in
Page_Load and declare on class level.
ImageButton save = new ImageButton();
save.ImageUrl = "save.gif"
save.Click += new...
|
by: Benjamin Gavin |
last post by:
Hi all,
I recently stumbled upon a bug in the ASP.NET framework handling of
ImageButton based postbacks. The issues derives from the fact that IE
and Mozilla handle the case of a
missing image...
|
by: tperri |
last post by:
I have an HTML table with several fields like this:
<A href="Savings.aspx?category=Food"><asp:imagebutton id="imgFood"
ImageUrl="images\buttons\btn-food-i.gif"...
|
by: Oddball |
last post by:
I have set up a page with uses two lots of image buttons, one for a collection and one for more images from that collection.
I generate all the image buttons on page init (I know, but I...
|
by: Robert Smith jr. |
last post by:
Hello,
Please pardon my newbie question ...
I am building an ASP.NET page that displays a recordset with a Delete
statement enabled (this all works fine). I want to Insert the current
row...
|
by: suzanne.boyle |
last post by:
Hi,
I'm adding an ImageButton as a child to a custom web control and
attaching an event handler to it. When the page posts back the event
is not being fired however. I initially assumed I had...
|
by: brock wade |
last post by:
I have a Datagrid that is working fine displying my records, but I'm
trying to program buttons
on each record line to launch another web page that shows all the
details for the product:
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |