Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 javascript with asp.net

views
     
TSayiesz
post Jan 19 2006, 12:52 PM, updated 19y ago

Selamat Hari Raya
*******
Senior Member
2,778 posts

Joined: Jan 2003
From: about:robots
CODE

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30456: 'do_nothing' is not a member of 'ASP.softpad_aspx'.

Source Error:



Line 27:   </COLGROUP>
Line 28:   <TR>
Line 29:    <TD><asp:Button onclick="do_nothing(this)" Width="50px" id="n1" Text="1" runat="server" onmouseover="numClicked(this)" onmouseout="verify(this)"/>
Line 30:    <TD><asp:Button Width="50px" id="n2" Text="2" runat="server" onmouseover="numClicked(this)" onmouseout="verify(this)"/>
Line 31:    <TD><asp:Button Width="50px" id="n3" Text="3" runat="server" onmouseover="numClicked(this)" onmouseout="verify(this)"/>


Source File: C:\Inetpub\wwwroot\xxx\softpad.aspx    Line: 29



ok, i have buttons, and i already associated it with onmouseover and onmouseout with javascript function. it worked.

but when i try to add onclick event with javascript function, it gives the error as above.

this code works
CODE

<asp:Button Width="50px" id="n1" Text="1" runat="server" onmouseover="numClicked(this)" onmouseout="verify(this)"/>


but this code not working
CODE

<asp:Button Width="50px" onclick="do_nothing(this)" id="n1" Text="1" runat="server" onmouseover="numClicked(this)" onmouseout="verify(this)"/>



i just want to stop the button from sending any action/executed to the server when it is clicked. is there any other way round?

This post has been edited by ayiesz: Jan 19 2006, 12:54 PM
shinchan^^
post Jan 19 2006, 02:13 PM

K66
*********
All Stars
21,256 posts

Joined: Jan 2003
From: Pekopon


use a client side button
frequency
post Jan 19 2006, 10:02 PM

我要挑战十个!
*******
Senior Member
2,552 posts

Joined: Jan 2003


Alternatively, u may continue using button that run on Server but with adding additional attribute "onmouseout" event with value calling ur verify function.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.Button1.Attributes.Add("onmouseout", "alert('ok')")

End Sub
shinchan^^
post Jan 20 2006, 10:01 AM

K66
*********
All Stars
21,256 posts

Joined: Jan 2003
From: Pekopon


u also can use the Response.write to write <script>javasscript here </SCRIPT> when u click the button
alvinz_c
post Jan 21 2006, 10:37 AM

Casual
***
Junior Member
407 posts

Joined: Oct 2004
Hi, I think it is better to use the RegisterStartupScript to emit the JavaScript code because using Response.Write() cause the page runs blank while the JS code is emitted, and you will notice that the CSS styling would go out of form.



 

Change to:
| Lo-Fi Version
0.0130sec    0.44    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 03:04 PM