Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RadioButton AutoPostBack does not execute JavaScript

Thread Tools

RadioButton AutoPostBack does not execute JavaScript

Posts: n/a
Hi everybody,

I have a Web form with something like:
<form id="Form1" method="post" onsubmit="javascript:submitForm();"

I need the JavaScript function submitForm() to execute everytime the form is

I also have two RadioButtons with AutoPostBack set to true.

The problem is when I click on one of the radio button, the form is posted
back, but the JavaScript is not executed. Is there a way to get some
JavaScript to execute everytime the Web form is posted back?

Thanks in advance.

Reply With Quote
Posts: n/a
The radio buttons you are using do not submit the form the same way a
button does. The OnSubmit event of the form object only fires when a
button of type Submit fires the event. When a radio button ( or
checkbox, or dropdownlist) is set to autopostback, that postback occurs
via the __doPostback function generated automatically by ASP.NET. This
function takes an eventTarget and an eventArgument, and posts this data
back to the sever. To see an example of this, view the HTML source on
your page. One way to get around this problem is to override the
__doPostback event in javascript, and execute your script from there.
One such example can be found here:

Hope this has been helpful, Good Luck!

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
RadioButton does not fire event in ASP.NET Brano ASP .Net 3 02-14-2010 08:04 PM
dropdownlist with autopostback set to true does not fire. Please help. Carlos ASP .Net 1 04-20-2007 07:09 PM
RadioButton GroupName does not work ! Mick ASP .Net 2 01-05-2005 10:15 AM
ASP.Net VB code does not execute on postback (WebMatrix vs. not) Brian Miller ASP .Net 6 11-27-2004 02:24 PM
Can i execute aspx file in my asp pag with server.execute method(sorry) Savas Ates ASP General 1 08-17-2004 04:52 PM