473,387 Members | 1,492 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,387 software developers and data experts.

How To Call Javascript function in asp.net

hi all can you tell me how to call javascript function
in .aspx page
i want to call it on onclick of button

this codebehind code giving me some other problem like
The viewstate is invalid for this page and might be
corrupted.
but it goes to that page

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As
System.EventArgs) Handles Button1.Click
Dim TestString As String = "<script
language='javascript'>" & _

"
window.document.FrmConsultant.action='SearchResume .aspx';"
& _

" window.document.FrmConsultant.method='post';" & _

" window.document.FrmConsultant.submit()</script> "

Page.RegisterStartupScript("TestString", TestString)

End Sub

hrishi

Nov 18 '05 #1
1 1321
Hi,

use

strScript = @"<script>
function MyJavascript()
{
do all your javascript manipulation/validations
return true; // if success
}
</script>"
Button1.Attributes.Add("onclick","return MyJavascript();")
Page.RegisterClientScriptBlock(strScript);
-Raja
-----Original Message-----
hi all can you tell me how to call javascript function
in .aspx page
i want to call it on onclick of button

this codebehind code giving me some other problem like
The viewstate is invalid for this page and might be
corrupted.
but it goes to that page

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As
System.EventArgs) Handles Button1.Click
Dim TestString As String = "<script
language='javascript'>" & _

"
window.document.FrmConsultant.action='SearchResum e.aspx';" & _

" window.document.FrmConsultant.method='post';" & _

" window.document.FrmConsultant.submit()</script> "

Page.RegisterStartupScript("TestString", TestString)

End Sub

hrishi

.

Nov 18 '05 #2

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

Similar topics

15
by: chirs | last post by:
I am trying to understand a piece of code. In a javascrpit file, there is a function: function ItemStyle(){ var names=; addProps(this,arguments,names,true); }; In the html file, it calls...
5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
1
by: cheezebeetle | last post by:
ok, so I am having problems passing in an ASPX function into the Javascript in the codebehind page. I am simply using a confirm call which when they press "OK" they call this ASPX function, when...
3
by: JoeK | last post by:
Hey all, I am automating a web page from Visual Foxpro. I can control all the textboxes, radio buttons, and command buttons using syntax such as: ...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
18
by: Chris Ianson | last post by:
Hi geniuses (or is that genii, or genies) The challenge is as above really. I have a page with an iframe in it, and need to call a JS function in the *parent* page, *from* inside the iframe. ...
3
by: KaNos | last post by:
Hi, "robot script pages" are html+javascript pages, can be played in aspx player. So in this tech, robot call aspx player's function (an interface is sheared) and wait a result synchronously with...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
10
by: evicailieva | last post by:
A have a php scrip where I call a JavaScript function. I don't know why, but it doesn't work. At the beginning, when I was writing the script it was working but now it's not. I don't know wхat to do....
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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,...

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.