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

RadioButton AutoPostBack does not execute JavaScript

M
Hi everybody,

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

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

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.
Nov 19 '05 #1
1 1940
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:

http://weblogs.asp.net/vga/archive/2...InWhidbey.aspx

Hope this has been helpful, Good Luck!

Nov 19 '05 #2

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

Similar topics

0
by: rodrigo | last post by:
I have a Asp.net table control that I dynamically add rows from a SQL database. Inside the table, I add radiobuttons and they all have different ID numbers according to BindChain() Looking In...
3
by: sofie | last post by:
Hello all, I use the following javascript function in a html document to set the level of one of eight available radiobuttons. The line that's commented out works fine under IE, but I need to...
2
by: alien2_51 | last post by:
Can some one tell me why the onclick is firing twice for the radion button and checkbox controls...? <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb"...
3
by: dave | last post by:
I have half a dozen web form radio buttons on a web form. Each of them is set to postback=true. However, if for instance radiobutton1 is already selected and the user selects it again, it performs...
2
by: Brano | last post by:
HI all, I have two radioButtons on my form. They both have autopostback = true and they are both in the same group. They both have event handlers for CheckedChanged event. My problem is ont of...
5
by: Barry | last post by:
I've wasted the whole day trying things and researching, but nothing is working. I would *greatly* appreciate if someone can give me the solution to this problem. I'm using the .NET Framework...
1
by: =?Utf-8?B?QWNl?= | last post by:
Hello, How can I make RadioButtons to display all in the same row? It looks that one Radio button per line by default. Secondly, I was wondering if there is a way to fire up Javascript when a...
0
by: BizEd | last post by:
I have a textbox that fires an autopostback when filled in. The next field after the textbox is a RadioButtonList which I set focus to. The radiobutton list does have focus and activates when you...
0
by: Emma Middlebrook | last post by:
Hi there, I'm having problems in an ASP.NET page that is dynamically creating and displaying radio buttons. I have setup a checkchanged event and specified AutoPostBack to true. When the page...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.