473,569 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help on ImageButton ??

Dear all,

I gave a datagrid object wich has a template column define as follow :

<asp:TemplateCo lumn HeaderText="Evt ">
<ItemTemplate >
<asp:ImageButto n id="ImageButton 2" ImageAlign=Midd le runat="server"
ImageUrl="event .gif" CommandName="Sh owEvent" CommandArgument
='<%#DataBinder .Eval(Container ,"DataItem.ID") %>' >
</asp:ImageButton >
</ItemTemplate>
</asp:TemplateCol umn>

When I click on my imagebutton I would like to trig the Command event of the
image button ?

How can I do that because phisycally the imagebutton is not seen in code as
it belongs to template

Or may be it is not working with it ?

Thnaks for your help
regards
serge
Jan 26 '06 #1
1 1494
In a similar scenario I explicitly set the server click event (see below):

<asp:TemplateCo lumn>
<ItemTemplate >
<asp:LinkButt on Runat="server" Text="Submit"
OnClick="Submit Profile_Click"> </asp:LinkButton>
</ItemTemplate>
</asp:TemplateCol umn>

Then in the code I redirected the click event back to the ItemCommand event
for the grid:

Protected Sub SubmitProfile_C lick(ByVal sender As Object, ByVal e As
EventArgs)
Dim btn As LinkButton = CType(sender, LinkButton)

'NOTE: I set the CommandName of the LinkButton to the ItemIndex for
where it exists in the ItemDataBound event for the grid
Me.myGrid_ItemC ommand(Me, _
New
DataGridCommand EventArgs(myGri d.Items(Convert .ToInt32(btn.Co mmandName)), _
myGrid, _
New CommandEventArg s("Select", Nothing)))
End Sub

HTH,

Matt Dinovo

"serge calderara" <se************ @discussions.mi crosoft.com> wrote in
message news:2B******** *************** ***********@mic rosoft.com...
Dear all,

I gave a datagrid object wich has a template column define as follow :

<asp:TemplateCo lumn HeaderText="Evt ">
<ItemTemplate >
<asp:ImageButto n id="ImageButton 2" ImageAlign=Midd le runat="server"
ImageUrl="event .gif" CommandName="Sh owEvent" CommandArgument
='<%#DataBinder .Eval(Container ,"DataItem.ID") %>' >
</asp:ImageButton >
</ItemTemplate>
</asp:TemplateCol umn>

When I click on my imagebutton I would like to trig the Command event of
the
image button ?

How can I do that because phisycally the imagebutton is not seen in code
as
it belongs to template

Or may be it is not working with it ?

Thnaks for your help
regards
serge

Jan 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3631
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 am trying to do. The ImageButton that is on the form handles its Command event just fine, but the ImageButton that is added to the cell does not...
0
1532
by: Kent P. Iler | last post by:
Hi, I have a data repeater that is returning a list of events. One of the things I want to do is give the user a way to edit or delete an event. My plan was to use an Imagebutton that would invoke a codebehind function that would either edit or delete the item. My problem is I need to pass the event_id as a parameter to each of these...
1
3335
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 ImageClickEventHandler(this.save_click); This ImageButton is added to a dynamic table which is also
5
7266
by: Darren Smith | last post by:
Hi There, I have a shopping cart app that displays products along with a textbox (to enter quantity) and an image button to add the item to the shopping cart. Please explain why my below Button_Click procedure does not retrieve the value of the textbox where the button was clicked. Thanks in Advance,
3
6293
by: tshad | last post by:
I was trying to change my asp:button to asp:ImageButton, but got a message saying that ImageButton does not have an onClick function. How do I get the ImageButton call a function? Thanks, Tom.
13
7419
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" runat="server"></asp:imagebutton></A> When the user sees these buttons, they will currently be on the savings.aspx?category=whatever page, and when they click another button to...
1
1121
by: Miguel Dias Moura | last post by:
Hi Cor and everybody else, i created a page with 5 panels and 5 buttons which control them acording to Cor's help. After this i used 5 image buttons instead of standard buttons. When i run the page i don't get any error but at the same time i don't see anything. I am doing something wrong here. Can you, Cor, or somebody else point me
3
1558
by: Aaron | last post by:
Why do my session values return to nothing on post back? I want to click a button and have the row, as in: dataset.table(0).rows(THIS ROW NUMBER IS WHAT I AM TALKING ABOUT), either increment or decrement to facilitate a movenext and movelast. I have been pulling my hair out and am at the end of my rope. PLEASE, how should I implement...
0
2369
by: DJOuk | last post by:
Posted this on Asp.Net, seems to be a hard problem, I still can't work it out I have a edit button, this works fine, until I add the code that prevents the edit button from being seen by users who did not post that ticket. I cannot understand why this is happening. I get an error on the button says 'object reference not set in instance of...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8119
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5509
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.