473,378 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

onclick event

Hi
I'm creating a web page where I use a rollover function on a html image. Can i associate the onclick event of this client control with a C# function resident on the aspx.cs file
Thank you
Fabrizio
Nov 16 '05 #1
4 2946
Hi,

You should be able to do it, use a ImageButton for that, then you have to
add the needed attributes using Control.Attributes like this :
theImageButton.Attributes.Add( "OnMouseOver","MethodToCall" );

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Fabrizio" <an*******@discussions.microsoft.com> wrote in message
news:57**********************************@microsof t.com...
Hi,
I'm creating a web page where I use a rollover function on a html image. Can i associate the onclick event of this client control with a C# function
resident on the aspx.cs file? Thank you,
Fabrizio

Nov 16 '05 #2
Hi
Unfortunately I already tried this, but doesn't work, it doesn't recognize the OnmouseOver even
Any other way to create a rolover effect
thank you
Fabrizio
Nov 16 '05 #3
Hi Fabrizio,

IT does work, Please note that the onmouseover is a client event, not a
serverside event
try this code:

in aspx file:
<asp:imagebutton runat="server" ImageUrl="images/b_addnew.gif"
ID="Imagebutton1" />

in code behind:
protected System.Web.UI.WebControls.ImageButton Imagebutton1;

private void Page_Load(object sender, System.EventArgs e)
{
Imagebutton1.Attributes.Add("onmouseover","alert(1 );");
}

It will show you an alert each time u pass over it.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Fabrizio" <an*******@discussions.microsoft.com> wrote in message
news:28**********************************@microsof t.com...
Hi,
Unfortunately I already tried this, but doesn't work, it doesn't recognize the OnmouseOver event Any other way to create a rolover effect?
thank you,
Fabrizio

Nov 16 '05 #4
Fabrizio wrote:
Hi,
I'm creating a web page where I use a rollover function on a html image. Can i associate the onclick event of this client control with a C# function resident on the aspx.cs file?
Thank you,
Fabrizio


What I do is put the image in an IMG tag and then put that inside an ASP
button.

I put the onMouseOver functions in the IMG tag.

The onClick of the button ( which contains the image ) is in the
codebehind ( cs ).
Nov 16 '05 #5

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

Similar topics

2
by: Andreas Knollmann | last post by:
Hi, I create an object like this: var cell = document.createElement("td"). It doesn't have to be cell. I want this cell to use the onclick event. What doesn't work in the IE as well as with...
2
by: RobG | last post by:
I am trying to dynamically add an onclick to an element, however I just can't get the syntax right. consider the following function: function doClick (evt,x) { // do things with evt and x } ...
17
by: abs | last post by:
My element: <span onclick="alert('test')" id="mySpan">test</span> Let's say that I don't know what is in this span's onclick event. Is it possible to add another action to this element's onclick...
6
by: Cockroach | last post by:
Hello, I have a problem where the onClick of a table row will activates a window.location event, and inside a cell in that row, an image onClick event shows/hides a div. The problem is that...
4
by: RobG | last post by:
I have a function whose parameter is a reference the element that called it: function someFunction(el) { ... } The function is assigned to the onclick event of some elements in the HTML...
5
by: moondaddy | last post by:
I have a <a> element in a datagrid which wraps some asp.net labels. this element also has an onclick event which does not fire in netscape 6 (and perhaps other browsers for all I know...). Below...
5
by: kai | last post by:
Hi, In ASP.NET , what is the difference between OnClick and Click events for a button? Because we have button click event, it can trigger events, why we still need OnClick? Please help. ...
7
by: extremerep | last post by:
My task is to change the value of a button and then make it functional with the onClick handler. Changing the value to "Play Again" works, but making the onClick work accordingly does not. The...
4
by: sameergn | last post by:
Hi, I have an image in my HTML form which has onclick() handler. There is also a submit button and a text box. Whenever text box has focus and user presses enter, the onclick() event of...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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 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.