473,513 Members | 2,493 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:TemplateColumn HeaderText="Evt">
<ItemTemplate>
<asp:ImageButton id="ImageButton2" ImageAlign=Middle runat="server"
ImageUrl="event.gif" CommandName="ShowEvent" CommandArgument
='<%#DataBinder.Eval(Container,"DataItem.ID")%>' >
</asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>

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 1489
In a similar scenario I explicitly set the server click event (see below):

<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton Runat="server" Text="Submit"
OnClick="SubmitProfile_Click"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>

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

Protected Sub SubmitProfile_Click(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_ItemCommand(Me, _
New
DataGridCommandEventArgs(myGrid.Items(Convert.ToIn t32(btn.CommandName)), _
myGrid, _
New CommandEventArgs("Select", Nothing)))
End Sub

HTH,

Matt Dinovo

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:2B**********************************@microsof t.com...
Dear all,

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

<asp:TemplateColumn HeaderText="Evt">
<ItemTemplate>
<asp:ImageButton id="ImageButton2" ImageAlign=Middle runat="server"
ImageUrl="event.gif" CommandName="ShowEvent" CommandArgument
='<%#DataBinder.Eval(Container,"DataItem.ID")%>' >
</asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>

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
3629
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...
0
1530
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...
1
3331
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...
5
7260
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...
3
6289
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, ...
13
7411
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"...
1
1118
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...
3
1555
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...
0
2365
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...
0
7161
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...
0
7384
Oralloy
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,...
0
7539
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...
1
7101
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...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5089
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...
0
4746
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...
0
3234
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...
0
1596
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.