473,836 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2.0 runtime javascript error - WebForm_PostBac kOptions is undefine

I am converting my enterprise solution from VS 2003 (.NET v1.1.4322) to VS
2005 (.NET v2.0.50727). The entire solution uses serveral technologies -
Windows Server 2003 (AD, SQL Server 2000, IIS, ASP.NET, ASP.NET Mobile)
Windows Mobile 2003 (Pocket IE)

I have completed a portion of the conversion (ASP.NET Mobile pages for PIE,
and some of the ASP.NET-bases web services), and while
testing I have a runtime error that did not exist in the 1.1 version.
It is associated with a Windows Mobile ObjectList (mobile:ObjectL ist )
When debugging on the desktop in IE 6.0 (I have *not* yet started conversion
testing with PIE on the PDA), I click on a linkbutton in the object list and
now receive a JavaScript error -
WebForm_PostBac kOptions is undefined.

I am not using Javascript explicitly in my code, the error is caused by
ASP.NET 2.0-generated Javascript.
My .aspx code for LinkButtons in the ObjectList looks like -
(<asp:LinkButto n ID="lbnTask" CommandName="de tails" Runat="server"> <%#
((ObjectListIte m)Container)["name"] %></asp:LinkButton> )

ASP.NET 2.0 generates javascript for the browser that looks like -
<TD><a id="olstTask__c tl1_lbnTask"
href="javascrip t:WebForm_DoPos tBackWithOption s(new
WebForm_PostBac kOptions("olstT ask:_ctl1:lbnTa sk", "", true, "", "", false,
true))">medicat e patient</a></TD>

Previously, ASP.NET 1.1 generated javascript for the browser that looks very
similar -
<TD><a id="olstTask__c tl1_lbnTask"
href="javascrip t:WebForm_DoPos tBackWithOption s(new
WebForm_PostBac kOptions("olstT ask:_ctl1:lbnTa sk", "", true, "", "", false,
true))">medicat e patient</a></TD>

I know there is JavaScript embedded in System.Web.dll, for example -
function WebForm_PostBac kOptions(eventT arget, eventArgument, validation,
validationGroup , actionUrl, trackFocus, clientSubmit)
My C# code behind already has "using System.Web;", and I tried adding "<%@
Import Namespace="Syst em.Web" %>" to the 2.0 .aspx file, but it did not help
with
this issue.

Is there a configuration step I am missing as part of the "port" to 2.0?
Jan 10 '06 #1
14 25647
I had a similar problem and it was a HttpModule that prevented ASP.NET
from serving the "WebResource.ax d" file (ASP.NET 2.0 uses this to
deliver scripts, this is different to ASP.NET 1.1).

Could this be your problem? Maybe try temporarily removing any modules
and see if it goes away.

Josh
http://www.thejoyofcode.com/

Jan 10 '06 #2
Josh -
Thanks for your reply.

You said it might be that an HttpModule prevented ASP.NET from serving the
"WebResource.ax d" file.

I am not at all sure what that means. Can you say a few more words about
what I might check to see if it is blocked. A log file somewhere?

"Josh Twist" wrote:
I had a similar problem and it was a HttpModule that prevented ASP.NET
from serving the "WebResource.ax d" file (ASP.NET 2.0 uses this to
deliver scripts, this is different to ASP.NET 1.1).

Could this be your problem? Maybe try temporarily removing any modules
and see if it goes away.

Josh
http://www.thejoyofcode.com/

Jan 11 '06 #3
Most of the JavaScript functions used by ASP.NET are served by a new
'page' called WebResource.axd . Can you see a link to this in your
source, would look something like:

<script src="WebResourc e.axd...

I had a HttpModule that intercepted all requests to my service to
rewrite urls (e.g. http://mydomain.com/showcategory.aspx?cat=taps to
http://mydomain.com/taps). It turned out that this was stopping the axd
from sending the script down and I got a heap of XXX is undefined
errors.

Josh

Jan 11 '06 #4
Josh,
Thanks again for hanging with me!

There is no reference to WebResource.axd anywhere in my "solution" directory
(C:\Inetpub\www root\poc_web\).
However, under C:\WINNT\Micros oft.NET\Framewo rk\v2.0.50727, in "web.config "
(which I have not modified directly), there is a section that starts
<httpHandlers >
<add path="trace.axd " verb="*"
type="System.We b.Handlers.Trac eHandler" validate="True" />
<add path="WebResour ce.axd" verb="GET"
type="System.We b.Handlers.Asse mblyResourceLoa der" validate="True" />
<add path="*.axd" verb="*" type="System.We b.HttpNotFoundH andler"
validate="True" />

etc....

Does that look OK? Is there some other configuration change I need to make,
or is there anything to look at while debugging?

"Josh Twist" wrote:
Most of the JavaScript functions used by ASP.NET are served by a new
'page' called WebResource.axd . Can you see a link to this in your
source, would look something like:

<script src="WebResourc e.axd...

I had a HttpModule that intercepted all requests to my service to
rewrite urls (e.g. http://mydomain.com/showcategory.aspx?cat=taps to
http://mydomain.com/taps). It turned out that this was stopping the axd
from sending the script down and I got a heap of XXX is undefined
errors.

Josh

Jan 11 '06 #5
Don't change that - that's supposed to be there. That's the bit that
makes sure WebResource.axd works properly :)

I suspect you'd know if you were using HttpModules, so this isn't your
problem. To be sure you can check your web.config file and see if there
are any httpModules configured. They'd be inside a <httpModules> node
somewhere under <system.web>.

However, I mean the web.config in your application, not the one in the
the folder you mention above.

Josh

Jan 11 '06 #6
Josh -
I don't have any httpModules set up in the application-level web.config file.

Any other ideas?

"Josh Twist" wrote:
Don't change that - that's supposed to be there. That's the bit that
makes sure WebResource.axd works properly :)

I suspect you'd know if you were using HttpModules, so this isn't your
problem. To be sure you can check your web.config file and see if there
are any httpModules configured. They'd be inside a <httpModules> node
somewhere under <system.web>.

However, I mean the web.config in your application, not the one in the
the folder you mention above.

Josh

Jan 11 '06 #7
Hmmm, not sure...

Let's make sure it is something to do with your WebResource.axd file.
Have a look in your src, you should have a line that looks something
like this (the random characters will be different)

<script
src="/WebResource.axd ?d=3v2Q4FZSi09Z wjYwg-vpMg2&amp;t=632 674154005468750 "
type="text/javascript"></script>

Grab the src path and try and view the file in your browser, i.e. goto
http://localhoast/MyApplication/WebR...74154005468750
(again your random chars will be different)

You will probably need to save the file and view it notepad. If
everything goes OK you should see a file full of lovely javascript...
if not then something is wrong... let me know how you get on.

You could also use ieHTTPHeaders to make sure the file is being
requested and sent back with a normal 200 response code. I wrote an
article about how to use ieHTTPHeaders here:
http://www.thejoyofcode.com/Better_u...TPHeaders.aspx

Hope that helps

Josh

Jan 11 '06 #8
Josh,
Thanks for hanging with me.
Here is the entire server-generated file for the page in 2.0.
Notice there is no reference to WebResource.axd at all!

-----start file-----

<html><body>
<form id="frmTasks" name="frmTasks" method="post"
action="poc_web _form1.aspx?__u fps=740275">
<input type="hidden" name="__VIEWSTA TE"
value="aDxfX1A7 QDxmcm1UYXNrczv pobPnlrTvuZngo4 gsMjs+Oz5tQovZR H9n2Sgf16Bh56ff mAdj3w==">
<input type="hidden" name="__EVENTTA RGET" value="">
<input type="hidden" name="__EVENTAR GUMENT" value="">
<script language=javasc ript><!--
function __doPostBack(ta rget, argument){
var theform = document.frmTas ks
theform.__EVENT TARGET.value = target
theform.__EVENT ARGUMENT.value = argument
theform.submit( )
}
// -->
</script>
<TABLE id="tblMyTasks " cellSpacing="1" cellPadding="1" width="300" border="0">
<TR><TD><IMG alt="Sea State 1" src="ss1_logo.p ng"></TD></TR>
<TR>
<TD>Task start:</TD>
<TD>Patient:</TD>
<TD>Task:</TD></TR>
<font size="-1">
<TR>
<TD><a id="olstTask__c tl1_lbnStart" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl1:l bnStart','')} ">10/24 9:00</a></TD>
<TD><a id="olstTask__c tl1_lbnPatient" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl1:l bnPatient','')} ">Lee, Terry</a></TD>
<TD><a id="olstTask__c tl1_lbnTask" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl1:l bnTask','')} ">medicate patient</a></TD></TR>
<TR bgcolor="#ccffc c">
<TD><a id="olstTask__c tl2_lbnStart_al t" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl2:l bnStart_alt','' )} ">10/24 9:20</a></TD>
<TD><a id="olstTask__c tl2_lbnPatient_ alt" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl2:l bnPatient_alt', '')} ">Sahu, Subakanta</a></TD>
<TD><a id="olstTask__c tl2_lbnTask_alt " href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl2:l bnTask_alt','') } ">medicate
patient</a></TD></TR>
<TR>
<TD><a id="olstTask__c tl3_lbnStart" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl3:l bnStart','')} ">10/24 9:30</a></TD>
<TD><a id="olstTask__c tl3_lbnPatient" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl3:l bnPatient','')} ">Sahu, Subakanta</a></TD>
<TD><a id="olstTask__c tl3_lbnTask" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl3:l bnTask','')} ">medicate patient</a></TD></TR>
<TR bgcolor="#ccffc c">
<TD><a id="olstTask__c tl4_lbnStart_al t" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl4:l bnStart_alt','' )} ">10/24 10:00</a></TD>
<TD><a id="olstTask__c tl4_lbnPatient_ alt" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl4:l bnPatient_alt', '')} ">Bar, Dale</a></TD>
<TD><a id="olstTask__c tl4_lbnTask_alt " href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl4:l bnTask_alt','') } ">medicate
patient</a></TD></TR>
<TR>
<TD><a id="olstTask__c tl5_lbnStart" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl5:l bnStart','')} ">10/24 10:10</a></TD>
<TD><a id="olstTask__c tl5_lbnPatient" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl5:l bnPatient','')} ">Bar, Dale</a></TD>
<TD><a id="olstTask__c tl5_lbnTask" href="javascrip t:{if
(typeof(Page_Cl ientValidate) != 'function' || Page_ClientVali date())
__doPostBack('o lstTask:_ctl5:l bnTask','')} ">medicate patient</a></TD></TR>
</TABLE>
<font size="+0"><a href="javascrip t:__doPostBack( 'frmTasks','2') "
Next</a></font></font></form></body></html>
-----end file-----

"Josh Twist" wrote:
Hmmm, not sure...

Let's make sure it is something to do with your WebResource.axd file.
Have a look in your src, you should have a line that looks something
like this (the random characters will be different)

<script
src="/WebResource.axd ?d=3v2Q4FZSi09Z wjYwg-vpMg2&t=6326741 54005468750"
type="text/javascript"></script>

Grab the src path and try and view the file in your browser, i.e. goto
http://localhoast/MyApplication/WebR...74154005468750
(again your random chars will be different)

You will probably need to save the file and view it notepad. If
everything goes OK you should see a file full of lovely javascript...
if not then something is wrong... let me know how you get on.

You could also use ieHTTPHeaders to make sure the file is being
requested and sent back with a normal 200 response code. I wrote an
article about how to use ieHTTPHeaders here:
http://www.thejoyofcode.com/Better_u...TPHeaders.aspx

Hope that helps

Josh

Jan 12 '06 #9
Hi Rich,

The source you've just sent doesn't contain any Javascript errors? I
just c&p'd it into a HTML file and viewed it in my browser, worked a
treat??

Josh

Jan 12 '06 #10

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

Similar topics

2
5938
by: Corey | last post by:
I recently received a Javascript error, "'WebForm_PostBackOptions' is undefined" from an application I'm working on. It occurs during the PostBack from a DropDownList. I've created a project which is only a DropDownList, with some Data and AutoPostBack = True, and it caused the error. I've ran aspnet_regiis -i, aspnet_regiis -c and regsvr32 c:\windows\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll.
7
44543
by: Erik-Jan Bakker | last post by:
Hello, I am stuck with a weird javascript problem.... ;-( Maybe it's somehting very simple, but I am really stuck in it, right now. What's the matter.... When place my website at a different hosting provider my webpage menu generates the javascript error:
2
2212
by: TeknoCat | last post by:
Hey everyone, I may be repeating myself here, but if someone sent a reply then I missed it, and I can't get Outlook Express to download any messages more than 2 days old. Anyway, I'm having a problem with some new pages I am creating for the Web site at www.weaverdevore.ca and I am wondering if anyone here might be able to help. Here is a full description of the problem:
6
1581
by: Richard Silverstein | last post by:
I'm a member of a forum sponsored by jasc.com ( http://forums.jasc.com/ ) which uses Webboard software. I use Firefox 1.0 (final release) as my browser. When I used previous versions of FF I had no problem logging into the forum. But with v. 1.0 I'm getting a javascript error saying "You could not be logged in." When I login from IE I don't have this problem. I've posted in this forum & the Firefox forum asking whether others have...
0
1455
by: Candi Suriano | last post by:
Help! I have a VB.Net dll that must be exposed to COM. The VB.Net program calls a C++ With managed extensions dll. When I try to reference the VB.Net dll from another VB.net program I get the following error message: Unable to emit assembly: Error emitting 'System.Runtime.InteropServices.GuidAttribute' attribute --'Common Language Runtime Internal error: 0x801311ca'
18
7346
by: William | last post by:
I have the following javascript function that updates a scroll_list and sends the updated entry (with its index) to a server script ( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further processing: function saveText( scroll_list, t_area, listToBeUpdated ) { scroll_list.options.text = t_area.text; scroll_list.options.value= t_area.value; var req; var url = "http://mkmxg00/cgi/confirmUpload.pl";
2
2148
by: Anonieko | last post by:
Hello ASPNET guru's, What is a clean way to go around the problem of displaying a GridView templated column where data can contain Single Quote ( ' )? I maybe too naive, but this is of course a common scenario. Scenario: * My database returns names that can contain single quote.
11
2379
by: TJM | last post by:
Hi, A Javascript error is generated when the user types a few character in an INPUT TYPE=FILE and hits a submit button. The form does not post. Is there a solution to this problem? Thanks TJM
2
6648
by: ZeeHseez | last post by:
Hi, I have written a webbrowser application in VB .net Framework 1.1. I would like to suppress javascript error messages. However, the silent property of the webbrowser control suppresses the Javascript messages, but it also blocks any other dialog box, such as Login dialog, i can't use the silent property. I used http://support.microsoft.com/default.aspx?scid=kb;EN-US;279535 article to suppress the error messages. It works fine until a...
0
9658
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10828
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10244
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7775
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6975
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5814
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4444
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3103
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.