Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 26, 2011 07:43 AM by vijay.reddy559
Member
529 Points
265 Posts
Feb 25, 2011 08:07 AM|LINK
Hi,
How to do javascript postback. like
function done()
{
document.getElementById('hid1').value = 'Ok';\\hidden field
alert('hi');
---After alert it has to postback.
}
How to do postabck in the above function ........
All-Star
37226 Points
6821 Posts
Feb 25, 2011 09:02 AM|LINK
see,
example http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx
Contributor
3606 Points
743 Posts
Feb 25, 2011 09:29 AM|LINK
hi vijay if you need to postback your page you just add return true in your javascript function after alert it will postaback your page
<html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script type="text/javascript"> function done() { alert('hi'); return true; } </script> </head> <body> <form id="form1" runat="server"> <asp:Button ID="Button1" runat="server" Text="Button" CssClass="cssbutton" OnClientClick="return done()" /> </form> </body> </html>
Feb 25, 2011 10:56 AM|LINK
Hi suresh thanks for ur reply..
I hope due to asp button might be a page can be postback, but my actual requirement is..
At runtime i have call a javascript function
Even i tried ur code like this... [it's not working]
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
function done() {
return true;
</script>
</head>
<body>
<input type="button" id="btn1" onclick="return done()" />
</body>
</html>
Star
14410 Points
2451 Posts
Feb 25, 2011 05:24 PM|LINK
HI,
u need to use IPostBackEventHandler
check this site:
http://msdn.microsoft.com/en-us/library/system.web.ui.ipostbackeventhandler.raisepostbackevent.aspx
---------------
Happy Coding.
Mark as Answer if it helps.
20155 Points
3328 Posts
Feb 25, 2011 05:47 PM|LINK
Try the following code
var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } theForm.submit();
Hope it helps u...
Feb 26, 2011 07:43 AM|LINK
Hi roopeshreddy
Thanq it's working fine....
vijay.reddy5...
Member
529 Points
265 Posts
Javascript PostBack ???
Feb 25, 2011 08:07 AM|LINK
Hi,
How to do javascript postback. like
function done()
{
document.getElementById('hid1').value = 'Ok';\\hidden field
alert('hi');
---After alert it has to postback.
}
How to do postabck in the above function ........
Check my website for ASP.Net Articles -
My Website
Rajneesh Ver...
All-Star
37226 Points
6821 Posts
Re: Javascript PostBack ???
Feb 25, 2011 09:02 AM|LINK
see,
example http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx
www.rajneeshverma.com
Keep Forums Clean || Use Alert Moderators.
suresh dasar...
Contributor
3606 Points
743 Posts
Re: Javascript PostBack ???
Feb 25, 2011 09:29 AM|LINK
hi vijay if you need to postback your page you just add return true in your javascript function after alert it will postaback your page
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
function done() {
alert('hi');
return true;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" CssClass="cssbutton" OnClientClick="return done()" />
</form>
</body>
</html>
Please "Mark as Answer" If post helps you
vijay.reddy5...
Member
529 Points
265 Posts
Re: Javascript PostBack ???
Feb 25, 2011 10:56 AM|LINK
Hi suresh thanks for ur reply..
I hope due to asp button might be a page can be postback, but my actual requirement is..
At runtime i have call a javascript function
Even i tried ur code like this... [it's not working]
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script type="text/javascript">
function done() {
alert('hi');
return true;
}
</script>
</head>
<body>
<input type="button" id="btn1" onclick="return done()" />
</body>
</html>
Check my website for ASP.Net Articles -
My Website
raju dasa
Star
14410 Points
2451 Posts
Re: Javascript PostBack ???
Feb 25, 2011 05:24 PM|LINK
HI,
u need to use IPostBackEventHandler
check this site:
http://msdn.microsoft.com/en-us/library/system.web.ui.ipostbackeventhandler.raisepostbackevent.aspx
---------------
Happy Coding.
Mark as Answer if it helps.
rajudasa.blogspot.com || blog@opera
roopeshreddy
All-Star
20155 Points
3328 Posts
Re: Javascript PostBack ???
Feb 25, 2011 05:47 PM|LINK
Hi,
Try the following code
var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } theForm.submit();Hope it helps u...
Roopesh Reddy C
Roopesh's Space
vijay.reddy5...
Member
529 Points
265 Posts
Re: Javascript PostBack ???
Feb 26, 2011 07:43 AM|LINK
Hi roopeshreddy
Thanq it's working fine....
Check my website for ASP.Net Articles -
My Website