_dopostback() in Javascript having problems with ctl prefix

S

Steve Steve

Hi there

I'm trying to add a couple of calendars to a web control so that a
client can view all the transactions they made between two dates. I use
one I found on the internet where there is a textbox with a button and a
calendar - you click the button which makes the calendar drop down and
when you select a date, the date string is put into the textbox for
submission.

Right my problem is that the javascript function _dopostback always
gives me an error "; Expected".

The code for the function - if I do view source is:

function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["_ctl4:_ctl0:calendarform"];
}
else {
theform = document._ctl4:_ctl0:calendarform;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

I assume that the function is having trouble with the colons in the
control prefix? Any ideas what else it could be if not?
Any way round this that anyone can think of?

Thanks
Steve
 
J

John Saunders

Steve Steve said:
Hi there

I'm trying to add a couple of calendars to a web control so that a
client can view all the transactions they made between two dates. I use
one I found on the internet where there is a textbox with a button and a
calendar - you click the button which makes the calendar drop down and
when you select a date, the date string is put into the textbox for
submission.

Right my problem is that the javascript function _dopostback always
gives me an error "; Expected".

The code for the function - if I do view source is:

function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
theform = document.forms["_ctl4:_ctl0:calendarform"];
}
else {
theform = document._ctl4:_ctl0:calendarform;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

I assume that the function is having trouble with the colons in the
control prefix? Any ideas what else it could be if not?
Any way round this that anyone can think of?

This is a known bug in Framework 1.1. There is a patch for it. See
http://support.microsoft.com/default.aspx?scid=kb;en-us;818803.
 
S

Steve Steve

Yes it is a bug with asp.net - you need to go on MSN and download the
latest hotfix for asp.net - just installed it and that solved the
problem.

Not too sure which fix it was so search for the problem on msn

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top