onmouseover in asp:imagebutton

Hi everyone,


I want to change the image of the <asp:imagebutton> when mouse comes
over the button and when it goes away. Is there any way I can do it.

Any help will be graetly appreciated.

Thanks.

0
vinki
2/25/2004 6:29:59 AM
asp.net.client-side 24353 articles. 0 followers. Follow

5 Replies
2301 Views

Similar Articles

[PageSpeed] 25

the following is a code example of how to do this:

<asp:ImageButton id="ImageButton1" onmouseover="this.src='button2.gif'" onclick="ImageButton1_click" onmouseout="this.src='button1.gif'" runat="server" ImageUrl="button1.gif"></asp:ImageButton>
here button1.gif is the original image, where button2.gif is the picture shown on mouse over.
hope this helps.
regards,
Dordanov
0
dordanov
2/25/2004 3:37:29 PM
Im not positive, but I think the imagebutton is rendered as an html image with an onclick event. So you should be able to do something like the following.

Dim img as ImageButton
ImageButton.ID = "myImgButton"
ImageButton.Attributes.Add("onmouseover", "changeImage(this, event, 'imageurl.gif')")
ImageButton.Attributes.Add("onmouseout", "changeImage(this, event, 'imageurl2.gif')")
then write a javascript function
changeImage(caller, events, imgURL){
caller.src = imgURL;
}
I will try to check this, but I think it should be close.
0
Philotech
2/25/2004 4:32:27 PM
Thanks everyone. Code is working now

0
vinki
2/26/2004 2:40:56 AM

Copy and paste the below code on Page Load Event .....

Make sure u have added an ImageButton and set the imageurl to open a Picture

When you move your mouse over the picture(image) you will see the image changes to another image

Map1.gif and Map.gif are two different picuters that i added u can add ur own pictures in that ....

 ImageButton1.Attributes.Add("onmouseover", "this.src='images/map1.gif'");
 ImageButton1.Attributes.Add("onmouseout", "this.src='images/map.gif'");


V.Sivakumar
0
Siva_V
9/26/2008 4:48:50 AM

Wow Siva,

Thank you very much for your post it worked like a charm.

 I am myself new to using ASP.NET, Althought I Like to work in Visual Basic not Csharp.  Your tip helped even me tackle and solve this problem.  I have Visual Studios 2005. I see it as a Godsend for makeing dynamic webpages quickly and yet still be full featured.

I am afraid I am a little ignoratin on object oriented language right now. can someone explain whats going on here? Can other Javascript attributes be added this way?

0
Noctechie
5/5/2009 6:49:57 AM
Reply:

Similar Artilces:

Jscript, moving from client-side to server-side (.NET)
Hey all I’m working translating a web-app written in client-side Jscript to run on the server-side as JScript.NET. Without needing to get too specific, I am using Jscript because the original page aggregated raw data to produce statistical results (this was done dynamically based on user 'sort-by' options). The final output is an html report that can be emailed. Because this is currently being done on the client side, as the raw data grows the load-time grows as well (to the point that has almost become unusable). I’m posting here to see if anyone has any experi...

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in asp.net ( required field, range validator and others)..my question is the required field validator is a server side control. So does that mean that it does a post back?..is it client side or server side control  The only controls that post back are buttons and other inputs where you set AutoPostback="True", such as a dropdownlist or a textbox.  Another way of posting back is using an UpdatePanel and placing a trigger in it for a specified control and/or event. All controls are considered clien...

When to use client side varidation and server side varidation in .net?
In .net or classic web application we can varidate user data either on client isde or server side. How to select which side varidate to be used? Thanks! Generally, I use both client and server validation. I make sure the input is in the correct format and reasonably valid on the client, then I verify the data on the server. The extent of validation also depends on the type of data that I need to validate.Here are a few references:Validating ASP.NET Server ControlsIntroduction to Validating User Input in Web FormsClient-Side Validation for ASP.NET Server ControlsSecurity Checklist...

communication between client side(java script) and server side in .net project
I have a question which is, when building a .net project, we are able to use server side code and client side code(java script). How do they communicate? Thanks Client Side coding works with the WebBrowser. So when ever you write client side code you have to keep browser compatability in your mind and you have to code. Server Side code works with Web Server (IIS) and it's ASPNET ISAPI's. The won't directly communicate with each other. But using AJAX you can all server side code from Client Side! Example article on Ajax@ http://www.devarticles.com/index2.php?option=content&task=...

.NET for client side?
Is this the idea of "Atlas" but using JavaScript rather than another technology? Atlas's goal is to abstract various browser implementations of DOM API and to ease out the developer's job to write rich client applications. Atlas hence makes use of the existing all-browser supported JavaScript to achieve this. Thanks for your reply.Let me convey my idea differently: I would like to author client side code using a class system. I recognise that Atlas is a technology for producing JS code, much in the same way that ASP.NET produces HTML for the browser.Will Atlas be m...

List of client side function of extenders and controls for client side
Hello All,I am using AJAX control toolkit for my current project. Now I need to find out what client side functions I can call on an extender. Lets say I am using a PopControlExtender. Now I want to show the popup from a JS funtions.If I can do a guess then it would be something like this$find('ppce').show();From where I can find what client side functions I can call on those extensders. This is really a frusterating thing. I learn about extenders only from Learn tutorials, no help here and there. Can anybody please tell me where are documentations about all the extenders in the tool...

Client side script for ImageButton
i've an Image Button in a item template of datalist bound to data. currently i've added some code in button_click event processed server side....but i want to write a client side script for that with the data bound....the container.dataitem and container.itemindex...but thats syntactically wrong...so please correct me  <asp:UpdatePanel ID="MyupdPnl" runat="server">            <ContentTemplate>                <asp:Da...

How to disable imagebutton at client side
Hi there, I am using Image buttons but I need do disable them at client side. How can we do that? Thanks Manish   try to image button visible property (<asp:ImageButton visible=false .....) document.getElementById('ImageId').disabled = 'disabled' or using css document.getElementById('ImageId').style.visibility = 'hidden'Don't forget to "Mark as Answer" if this post answered your questionLife's goodMy Site You can usedocument.getElementById('<%=ImageButton1.ClientID%>').style.display = "none";HC...

Side by Side Execution of .net v1.1 and .net v2.0
Hi i am new bie to asp.net 2.0.Till date i have been developing projects using VS.Net 1.1 and now i hv decided to upgrade to new version 2.0.Now i want to run and develop my projects using any of the versions as desired.My question is that can i install vs 2.0 without updating the previous version and will i be able to develop and run my applications in any of the versions as desired.i have been known that we can run these versions side by side(i.e. one application can use 1.1 and other 2.0),but can we do side by side development as well(i.e. one application can use 1.1...

.Net Framework needed on the client side?
Hi, Do I need to install the .Net Framework to be able to view .aspx files or just need a browser supporting .aspx files? Thanks HI No, u dont need to install the .net framework the browser is enough. Regards. Hi, ASP.NET webforms and controls that you use emit HTML. This is a markup language that a browser understands. So no, a browser is the only thing needed on the client when viewing webapplications built with ASP.NET. Grz, Kris.Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

Do i need a .Net framework on the client side?
Hello all, Can anyone tell me if there is a .Net framework needed on the client side when want to run an ASP .Net web application? Or will it generate plain html that only requires an Internet browser? Or is it dependent on the version of ASP.Net (1.0, 1.1, 2.0?)   Thanks!   AlbertWeeda     There is no need for the .NET framework to be on the client computer to access your web applications.ASP.NET Websites renders into HTML so all your client needs is a HTML web browser.  you don't need it. and it generates plain html that only requires an Intern...

Changing client side cookies in .NET
I have a few cookies in my applicaiton which are created using javascript. Now I can read the cookies no problem. I can create the cookies in .NET and read them in javascript no problem. If the cookie is created in .NET i can modify it's value in .NET no problem. If the cookie is create in javascript I can modify it's value in javascript no problem. What I can't do is change the value of a cookie created in javascript using .NET. I have tried every permutation of Cookies.Add, Cookies.Set, Cookies.Remove using both the response and request objects. I can debug the code and see ...

.Net varible into client side JavaScript
I'm need to get a variable from my web app and place its value in a JavaScript. I tried doing this with a Label but I get the HTML included. I don't think I can use the <%# %> from classic ASP? Anyone have any ideas on how they would approach this problem? tbone_stl wrote:Anyone have any ideas on how they would approach this problem? Hi, and welcome to the ASP.NET forums. It's possible to pass a variable to a javascript function. I created a small coding snippet: <%@ Page Language="C#" %>   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http...

Client side .Net Framework version
Dearl All,I have got a windows form embedded into a web application which requires .Net Framework 2.0 on the client end.Now my question is that how can I check if the client has .Net Framework installed or not and also which version it is? Thanks  You can check it through javascript from web app. .NET embeds its version information to IE user agent. So, in IE you can check for .NET with window.navigator.userAgent. For example use the following line in JavaScript to detect .NET 2.0: if (window.navigator.userAgent.indexOf(".NET CLR 2.0") != -1) { // some code goes...

Side by Side Execution of .net v1.1 and .net v2.0 (continued)
Hi, Dave wrote a previous post that said: "If you are referring to web applications - each Virtual server must specify the framework to run under.  Both can run side-by-side.. but not under the same virtual server (application pool)" That looks fine, but I wonder: Is it just as easy as going to Administrative Tools --> IIS --> Select the virtual directory --> go to the property's ASP.NET tab and then selecting the ASP.NET version? Is there some important information that I need to know before going into this? Are there going to be ANY issues I should be aware of? T...

Web resources about - onmouseover in asp:imagebutton - asp.net.client-side

Resources last updated: 1/1/2016 6:33:59 PM