Hi!
I'm using a DataGrid with a template column to display an Image inside
of it. I'm hooking into its OnPrerender-Event to set the
ImageURL-Property dynamically.
Everything works just fine here, until I thought "It would be cool, if
the user could click on that image..". So I replaced the Image-Control
with an ImageButton.
My Problem is, that the ImageButton doesn't fire any events. Any other
control works just fine but I'm having no luck getting the ImageButton
to work.
I'm happy about any ideas..
Regards
Jens
------------------------------------------------
Code-Snippet
-------------------
aspx-Page
<asp:TemplateCo lumn HeaderText="Ima ges">
<ItemTemplate >
<asp:Image id="imgPic" runat="server"
OnPreRender="im gPic_PreRender" ></asp:Image>  ;
<asp:ImageButto n id="ibtnPic" runat="server"
OnPreRender="ib tnPic_PreRender "></asp:ImageButton >
</ItemTemplate>
</asp:TemplateCol umn>
-------------------
CodeBehind
protected void imgPic_PreRende r(object sender, System.EventArg s e)
{
//this works as expected
Image img = sender as Image;
if (img == null)
{
return;
}
img.ImageURL = "dynamicall y-assigned.jpg";
}
protected void ibtnPic_PreRend er(object sender, System.EventArg s e)
{
//this does not work
//
//if I rename this Method for testing purposes, the Page can't
//be loaded, as it doesn't find this Method
//
//if I set a Break-Point to first method, the program does not
//stop
ImageButton ibtn = sender as ImageButton;
if (ibtn == null)
{
return;
}
ibtn.ImageURL = "dynamicall y-assigned.jpg";
} 3 3905
Jens,
With thwe ImageButton you can setup both the Click and Command events. Do
you setup one of them?
Eliyahu
<je*********@gm x.net> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com... Hi!
I'm using a DataGrid with a template column to display an Image inside of it. I'm hooking into its OnPrerender-Event to set the ImageURL-Property dynamically. Everything works just fine here, until I thought "It would be cool, if the user could click on that image..". So I replaced the Image-Control with an ImageButton.
My Problem is, that the ImageButton doesn't fire any events. Any other control works just fine but I'm having no luck getting the ImageButton to work.
I'm happy about any ideas..
Regards Jens
------------------------------------------------ Code-Snippet
------------------- aspx-Page
<asp:TemplateCo lumn HeaderText="Ima ges"> <ItemTemplate > <asp:Image id="imgPic" runat="server" OnPreRender="im gPic_PreRender" ></asp:Image>  ; <asp:ImageButto n id="ibtnPic" runat="server" OnPreRender="ib tnPic_PreRender "></asp:ImageButton > </ItemTemplate> </asp:TemplateCol umn>
------------------- CodeBehind
protected void imgPic_PreRende r(object sender, System.EventArg s e) { //this works as expected Image img = sender as Image; if (img == null) { return; } img.ImageURL = "dynamicall y-assigned.jpg"; }
protected void ibtnPic_PreRend er(object sender, System.EventArg s e) { //this does not work // //if I rename this Method for testing purposes, the Page can't //be loaded, as it doesn't find this Method // //if I set a Break-Point to first method, the program does not //stop ImageButton ibtn = sender as ImageButton; if (ibtn == null) { return; } ibtn.ImageURL = "dynamicall y-assigned.jpg"; }
Thanks for your Answer!
I can set up the Click event to parse the CommandName and
CommandArgument . This is a way to react on the users PostBack, no
problem here.
The problem is, that i need the PreRender event to handle the ImageURL
before the ImageButton is drawn. At the moment, I can't catch this
event in the same way, as it works for the Image-control, so that the
image, the ImageButtons renders, is "none".
Jens
Why can't you handle the ImageUrl in Click event?
Eliyahu
<je*********@gm x.net> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com... Thanks for your Answer!
I can set up the Click event to parse the CommandName and CommandArgument . This is a way to react on the users PostBack, no problem here.
The problem is, that i need the PreRender event to handle the ImageURL before the ImageButton is drawn. At the moment, I can't catch this event in the same way, as it works for the Image-control, so that the image, the ImageButtons renders, is "none".
Jens This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Miguel Dias Moura |
last post by:
Hello,
i have an image with the following code:
<img src="image/panel.gif" width="20" height="80"
onClick="fnLoadNewWindow('http://www.google.com');">
When i click the image the Javascript Function fnLoadNewWindow opens a new
window with google.com.
The problem is that the mouse doesn't change when it's over the image to the
|
by: Holly |
last post by:
Hi,
I have a page (A) that allows users to enter addresses
and displays direction information and map images.
The page A calls Microsoft's mappoint web service, gets
the route info and map image. Page A contains an image
button with the image url set as MapOutput.aspx
<asp:imagebutton id="ibtnMap" runat="server"
ImageUrl="MapOutput.aspx"></asp:imagebutton>
After page A got the image, it stores the image into
|
by: Varangian |
last post by:
Hi there experts,
Is there a way to convert a System.Drawing.Image to an ImageButton.
Maybe using ChangeType I don't know!
Thank you
|
by: CK |
last post by:
Hello All,
I am trying to extend the default asp:ImageButton to include an image for an
enabled state and a second image for a disabled state. I currently did this
by extending the ImageButton class in a custom control, creating a property
for each of these images (EnabledImageUrl, DisabledImageUrl) and then
overrode the Enabled property to change base.ImageUrl respectively. I am
also trying to use Themes with this web site. The problem...
|
by: Edwin Knoppert |
last post by:
I have an asp.net imagebutton with a clickevent.
I have enclosed an anchor around the image and a small text.
If i click the image the event is executed (while the href of the anchor
shows in the statusbar)
If the user clicks the image or the text beneat it it should do the same,
executing the image asp.net server event.
I can manage this fine using javascript but the href must contain a
character to get the mousehand.
| |
by: Ganesh |
last post by:
Hi There,
Could you some tell me the difference between Image and ImageButton, which
one do i need to use if i want to show some picture on the html
Thanks
Ganapathi
|
by: Nathan Sokalski |
last post by:
I am using the ImageUrl property of the HyperLink control. My image is
large, so I am setting the width/height attributes, but when it renders the
width/height attributes are in the <atag rather than the <imgtag,
therefore not making the image the size I want. I can obviously place an
Image control inside the HyperLink, but the HyperLink was obviously intended
to render both. Is there a way around this without using multiple controls?...
|
by: Sully |
last post by:
Hi Guys,
I have this about 98% done and I cannot get it work properly. I have a
Repeater bound to a MySQL DataSource, inside the Repeater I have an
ImageButton, outside the repeater I have a Image, code is below:
<asp:Image ID="imgLarge" Name="imgLarge" runat="server"
AlternateText="Large Custom Image" Height="300" Width="400" />
<asp:Repeater ID="rptSmall" runat="server"
OnItemDataBound="rptSmall_ItemDataBound1">
|
by: premprakashbhati |
last post by:
hi, good evening..
i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button()
here is the code ...its work fine when iam using a normal web page... but can't in content page....
Code in Master Page
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="submaster.master.cs" Inherits="submaster" %>
<%@ Register Assembly="AjaxControlToolkit"...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |