473,398 Members | 2,812 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,398 software developers and data experts.

2 onlick events?

I have a clickable image that I would like to convert into a server control
imagebutton accessing a server-side onClick event and a client-side
javascript onclick event as well. Is this possible? How can I invoke both
the client side javascript event and the server side VB?

Here's what I started with:

<A
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
HREF="default.aspx?pageID=shas">

<IMG
SRC="TabB.gif" WIDTH="217"
BORDER="0" NAME="TabB">

</A>

Here's what I'm stuck on for an equivalent imagebutton server control...also
notice that VS.NET doesn't like the onMouseOver and onMouseClick attributes.

<ASP:IMAGEBUTTON
ID="ImageButton1"
RUNAT="server"
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
IMAGEURL="TabB.gifdefault.aspx?pageID=shas">
</ASP:IMAGEBUTTON>


--
_____
DC G


Jul 21 '05 #1
4 1792
DC Gringo wrote:
I have a clickable image that I would like to convert into a server control
imagebutton accessing a server-side onClick event and a client-side
javascript onclick event as well. Is this possible? How can I invoke both
the client side javascript event and the server side VB?

Here's what I started with:

<A
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
HREF="default.aspx?pageID=shas">

<IMG
SRC="TabB.gif" WIDTH="217"
BORDER="0" NAME="TabB">

</A>

Here's what I'm stuck on for an equivalent imagebutton server control...also
notice that VS.NET doesn't like the onMouseOver and onMouseClick attributes.

<ASP:IMAGEBUTTON
ID="ImageButton1"
RUNAT="server"
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
IMAGEURL="TabB.gifdefault.aspx?pageID=shas">
</ASP:IMAGEBUTTON>

As far as I know, this is not possible.
However you can write you script code so that, you will invoke
_doPostBack method yourself.

But I don't see the point where you will need to do that.
If you explain your point then I can help more.
--

SevDer
http://www.sevder.com
Jul 21 '05 #2
Ok, what I'm trying to do is maintain a rollover effect but also invoke a
servers-side Sub btn_onClick(). First problem is that VS.NET doesn't like
onMouseOver or onMouseOut as it doesn't find those attributes. Upon running
the app, the first error thrown is comilation error: 'MM_nbGroup' is not a
member of 'ASP.communities_ascx'. (my MM_nbGroup function is in a .js file
which is at the bottom for your reference:
This works (but without my server-side Sub:

<A ONCLICK="MM_nbGroup('down','navbar1','TabB','TabB_ f3.gif',1);"
HREF="default.aspx?pageID=shas"><IMG HEIGHT="31" SRC="TabB.gif" WIDTH="217"
BORDER="0" NAME="TabB"></A>
Now I"m trying to move to this but getting the error mentioned above.

<ASP:IMAGEBUTTON ID="imgShasTab" NAME="TabB" RUNAT="server"
ONMOUSEOVER="MM_nbGroup('over','TabB','TabB_f2.gif ','TabB_f3.gif',1);"
ONMOUSEOUT="MM_nbGroup('out');"
ONCLICK="MM_nbGroup('down','navbar1','TabB','TabB_ f3.gif',1);"
IMAGEURL="TabB.gif" WIDTH="217" BORDERWIDTH="0"></ASP:IMAGEBUTTON>

Which should invoke:

Private Sub imgShasTab_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
Response.Redirect("~/advanced/default.aspx?pageID=shas")

End Sub
Here's the javascript function MM_nbGroup

function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new
Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null)
{
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null)
{
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] :
img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn :
img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up;
img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null)
{
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
"SevDer" <do****@sevder.com> wrote in message
news:uh**************@TK2MSFTNGP09.phx.gbl...
DC Gringo wrote:
I have a clickable image that I would like to convert into a server control imagebutton accessing a server-side onClick event and a client-side
javascript onclick event as well. Is this possible? How can I invoke both the client side javascript event and the server side VB?

Here's what I started with:

<A
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
HREF="default.aspx?pageID=shas">

<IMG
SRC="TabB.gif" WIDTH="217"
BORDER="0" NAME="TabB">

</A>

Here's what I'm stuck on for an equivalent imagebutton server control...also notice that VS.NET doesn't like the onMouseOver and onMouseClick attributes.
<ASP:IMAGEBUTTON
ID="ImageButton1"
RUNAT="server"
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
IMAGEURL="TabB.gifdefault.aspx?pageID=shas">
</ASP:IMAGEBUTTON>

As far as I know, this is not possible.
However you can write you script code so that, you will invoke
_doPostBack method yourself.

But I don't see the point where you will need to do that.
If you explain your point then I can help more.
--

SevDer
http://www.sevder.com

Jul 21 '05 #3
in the page load try

this.imgShasTab.attibutes.add("onmouseover","javas cript:MM_nbGroup('over','T
abB','TabB_f2.gif','TabB_f3.gif',1);")
repeat for your other client side events

for the on click you will need to call the server side script from your
javascript
at the end of your javascript you will need to add something like

getelementbyid['__EventTarget'].value= imgShasTab
document.form.submit

what this does is it tells the page post back that the event that triggered
the post back was a click on the control imgShasTab

the thing is asp.net controls don't like "sensitive" feature that react on
the client , it's server based after all.

hope this helps

"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:el*************@TK2MSFTNGP10.phx.gbl...
Ok, what I'm trying to do is maintain a rollover effect but also invoke a
servers-side Sub btn_onClick(). First problem is that VS.NET doesn't like
onMouseOver or onMouseOut as it doesn't find those attributes. Upon running the app, the first error thrown is comilation error: 'MM_nbGroup' is not a
member of 'ASP.communities_ascx'. (my MM_nbGroup function is in a .js file
which is at the bottom for your reference:
This works (but without my server-side Sub:

<A ONCLICK="MM_nbGroup('down','navbar1','TabB','TabB_ f3.gif',1);"
HREF="default.aspx?pageID=shas"><IMG HEIGHT="31" SRC="TabB.gif" WIDTH="217" BORDER="0" NAME="TabB"></A>
Now I"m trying to move to this but getting the error mentioned above.

<ASP:IMAGEBUTTON ID="imgShasTab" NAME="TabB" RUNAT="server"
ONMOUSEOVER="MM_nbGroup('over','TabB','TabB_f2.gif ','TabB_f3.gif',1);"
ONMOUSEOUT="MM_nbGroup('out');"
ONCLICK="MM_nbGroup('down','navbar1','TabB','TabB_ f3.gif',1);"
IMAGEURL="TabB.gif" WIDTH="217" BORDERWIDTH="0"></ASP:IMAGEBUTTON>

Which should invoke:

Private Sub imgShasTab_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
Response.Redirect("~/advanced/default.aspx?pageID=shas")

End Sub
Here's the javascript function MM_nbGroup

function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new
Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] :
img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn :
img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up;
img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
"SevDer" <do****@sevder.com> wrote in message
news:uh**************@TK2MSFTNGP09.phx.gbl...
DC Gringo wrote:
I have a clickable image that I would like to convert into a server control imagebutton accessing a server-side onClick event and a client-side
javascript onclick event as well. Is this possible? How can I invoke both the client side javascript event and the server side VB?

Here's what I started with:

<A
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
HREF="default.aspx?pageID=shas">

<IMG
SRC="TabB.gif" WIDTH="217"
BORDER="0" NAME="TabB">

</A>

Here's what I'm stuck on for an equivalent imagebutton server control...also notice that VS.NET doesn't like the onMouseOver and onMouseClick attributes.
<ASP:IMAGEBUTTON
ID="ImageButton1"
RUNAT="server"
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
IMAGEURL="TabB.gifdefault.aspx?pageID=shas">
</ASP:IMAGEBUTTON>

As far as I know, this is not possible.
However you can write you script code so that, you will invoke
_doPostBack method yourself.

But I don't see the point where you will need to do that.
If you explain your point then I can help more.
--

SevDer
http://www.sevder.com


Jul 21 '05 #4
try this:

<ASP:IMAGEBUTTON ID="imgShasTab" NAME="TabB" RUNAT="server"
IMAGEURL="TabB.gif" WIDTH="217" BORDERWIDTH="0"></ASP:IMAGEBUTTON>
on the page load :
imgShasTab.attributes.add("OnMouseOver", "MM_nbGroup('whatever');")
imgShasTab.attributes.add("OnMouseOut", "MM_nbGroup('whatever');")

hope this helps..

"DC Gringo" wrote:
Ok, what I'm trying to do is maintain a rollover effect but also invoke a
servers-side Sub btn_onClick(). First problem is that VS.NET doesn't like
onMouseOver or onMouseOut as it doesn't find those attributes. Upon running
the app, the first error thrown is comilation error: 'MM_nbGroup' is not a
member of 'ASP.communities_ascx'. (my MM_nbGroup function is in a .js file
which is at the bottom for your reference:
This works (but without my server-side Sub:

<A ONCLICK="MM_nbGroup('down','navbar1','TabB','TabB_ f3.gif',1);"
HREF="default.aspx?pageID=shas"><IMG HEIGHT="31" SRC="TabB.gif" WIDTH="217"
BORDER="0" NAME="TabB"></A>
Now I"m trying to move to this but getting the error mentioned above.

<ASP:IMAGEBUTTON ID="imgShasTab" NAME="TabB" RUNAT="server"
ONMOUSEOVER="MM_nbGroup('over','TabB','TabB_f2.gif ','TabB_f3.gif',1);"
ONMOUSEOUT="MM_nbGroup('out');"
ONCLICK="MM_nbGroup('down','navbar1','TabB','TabB_ f3.gif',1);"
IMAGEURL="TabB.gif" WIDTH="217" BORDERWIDTH="0"></ASP:IMAGEBUTTON>

Which should invoke:

Private Sub imgShasTab_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
Response.Redirect("~/advanced/default.aspx?pageID=shas")

End Sub
Here's the javascript function MM_nbGroup

function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new
Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null)
{
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null)
{
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] :
img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn :
img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up;
img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null)
{
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
"SevDer" <do****@sevder.com> wrote in message
news:uh**************@TK2MSFTNGP09.phx.gbl...
DC Gringo wrote:
I have a clickable image that I would like to convert into a server control imagebutton accessing a server-side onClick event and a client-side
javascript onclick event as well. Is this possible? How can I invoke both the client side javascript event and the server side VB?

Here's what I started with:

<A
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
HREF="default.aspx?pageID=shas">

<IMG
SRC="TabB.gif" WIDTH="217"
BORDER="0" NAME="TabB">

</A>

Here's what I'm stuck on for an equivalent imagebutton server control...also notice that VS.NET doesn't like the onMouseOver and onMouseClick attributes.
<ASP:IMAGEBUTTON
ID="ImageButton1"
RUNAT="server"
ONMOUSEOVER="nbGroup('over','TabB','TabB_f2.gif',' TabB_f3.gif',1);"
ONCLICK="nbGroup('down','navbar1','TabB','TabB_f3. gif',1);"
ONMOUSEOUT="nbGroup('out');"
IMAGEURL="TabB.gifdefault.aspx?pageID=shas">
</ASP:IMAGEBUTTON>

As far as I know, this is not possible.
However you can write you script code so that, you will invoke
_doPostBack method yourself.

But I don't see the point where you will need to do that.
If you explain your point then I can help more.
--

SevDer
http://www.sevder.com


Jul 21 '05 #5

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

Similar topics

3
by: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When...
14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
4
by: DC Gringo | last post by:
I have a clickable image that I would like to convert into a server control imagebutton accessing a server-side onClick event and a client-side javascript onclick event as well. Is this possible? ...
2
by: Lars Netzel | last post by:
I have a simple aspx form where a few fields are validated with RequiredFieledValidators. They work fine.. Now I needed to add an own onclick validation that checks something else and that has a...
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
3
by: Cylix | last post by:
my function: function displayFiles(files, curPath) { var d = document.getElementById('folderContent'); d.innerHTML = ''; if (!(d&&files)) return; var aryFiles = files.split('|'); var node,...
14
by: xoozlez | last post by:
Hi there, I have a registration form where I like to filter out the past events of 2007. This is the code I am using : strSQL = "SELECT EventID, EventName, EventDateBegin, EventDateEnd,...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
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,...
0
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
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
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
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...
0
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,...
0
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...

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.