Checkbox AutoPostBack Problem

netpicker9
02-01-2007, 01:23 PM
Hi,

I have a Checkbox (<asp:CheckBox runat="server" ID="CheckBox1" AutoPostBack="true" />) in a ASP.net Content page

When I click on the checkbox, it giving JavaScript Error as Object doesn't support this property or method
Line: 48
Char: 9

The line which its pointing is a doPostBack javascript block.

<script type="text/javascript">
<!--
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>

What is the solution for this?

how can I change theForm.submit(); to document.aspnetForm.submit(); , is that possible?

wayneph
02-01-2007, 03:02 PM
I don't think that's your real problem.

Currently theForm.submit() IS document.aspnetForm.submit(). That's what the lines of code above the function are doing.

Any more information about what your checkbox is doing? or is this releated to the other question you posted in the Web Programming forum? :(

netpicker9
02-02-2007, 07:54 AM
Hi wayneph,

My post on other forum is different.

In this page, When user clicks on Checkbox, I want to assign PostbackURL to a Button,

for example, On page load, Button1 will be assigned to Second.aspx, If user selectes the checkbox, I want to change to Third.aspx.

Here is the viewsource of checkbox,

<input id="ctl00_ContentPlaceHolder1_Checkbox1" type="checkbox" name="ctl00$ContentPlaceHolder1$Checkbox1" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$Checkb ox1\',\'\')', 0)" />

Please help me with this.

thanks in advance

netpicker9
02-02-2007, 08:40 AM
Hi wayneph,

I got the solution, I have html button in the same page
<input type="Submit" value="Submit" name="Submit" id="Submit">

I changed name and id to capital "S" (before that its lower case).. and its working..

frankly I don't know the reason for it..

thanks anyway.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum