22

On one of my pages, my dynamic links work fine in IE10 but do not work in either Chrome or via Explorer on my Windows phone. In Chrome I get the "WebForm_DoPostBackWithOptions is not defined" when I try to click on any of the dynamic links. I've done a lot of research, and have tried to modify the settings for the ISAPI filters in the Handler Mappings in IIS 8, but that didn't work. Please help. I'm stumped.

Update: This also does not work in Firefox. It seems the dynamic links on this page work only in IE10. The links are being generated from my codebehind. The strange this is that on the other pages the links are generated differently with the javascript on the href being different, yet I'm creating the anchors in the codebehind exactly the same way.

Here's code for a "bad" anchor:

    Dim anchName As New HtmlAnchor
anchName.ID = "bcrasodiuhf" & foo
AddHandler anchName.ServerClick, AddressOf HandleNameClick
anchName.Attributes.Add("style", "font-weight: bold; font-size: 14px;")
anchName.Attributes.Add("for", foo)
anchName.InnerText = foo

And the "bad" result:

<a id="MainContent_bcrasodiuhf1" **href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBac…0$MainContent$bcrasodiuhf1", "", true, "", "", false, true))**" for="1" style="font-weight: bold; font-size: 14px;"></a>

Here is a "working" anchor:

    Dim ancJoe As New HtmlAnchor
    ancJoe.ID = "pjancJoe" & foo
    AddHandler ancJoe.ServerClick, AddressOf HandleJoeClick
    ancJoe.InnerText = joe.Title
    ancJoe.Attributes.Add("style", "font-size: 150%;")
    ancJoe.Attributes.Add("jn", foo)
    ancJoe.Attributes.Add("for", foo)
    ancJoe.Attributes.Add("action", "actionA")  

And the "working" result:

<a id="MainContent_pcancJoe19416" **href="javascript:__doPostBack('ctl00$MainContent$pcancJoe19416','')"** action="actionA" for="194" jn="foo foo" forc="16" style="font-size: 150%;"></a>
Jaymin
  • 2,879
  • 3
  • 19
  • 35
brad
  • 605
  • 2
  • 7
  • 18
  • 1
    Update: So, I have a couple of RegularExpressionValidator and a CompareValidator on this page to validate a couple of static fields. When I remove those, then the generated href uses __doPostBack and it works fine. So, the question is: why can't any browser except IE10 find WebForm_DoPostBackWithOptions? – brad Apr 20 '14 at 17:16
  • Well, it appears none of my fieldvalidators work in anything other than IE10. Chrome and Firefox throw the same error: WebForm_DoPostBackWithOptions is not defined and Page_ClientValidate is not defined. – brad Apr 20 '14 at 19:30
  • Latest Update: If you guys ignore this post long enough I just might figure it out myself. :) I've narrowed it down to url rewrites I have in web.config. I have no idea how that is affecting things and I certainly want to implement url rewrite, so I appreciate any help. – brad Apr 20 '14 at 21:16
  • ever figured out what happened? I have similar issue – Ziv Weissman May 13 '15 at 08:31
  • Maybe this other thread on SO may help point you in the right direction http://stackoverflow.com/questions/4410067/iis-url-rewrite-and-web-config – Zeddy May 13 '15 at 23:47
  • @brad have you tried setting `CausesValidation=false` on your `HtmlAnchor` ? For example: `anchName.CausesValidation=false` – Trevor May 14 '15 at 21:05

4 Answers4

2

The respective JS code (i.e. WebForm_DoPostBackWithOptions(options)) is a built-in part and is linked dynamically. A proper URL is being generated by ScriptManager of the page.

Considering you've mentioned you're using URL Rewrite, try checking whether URLs like WebResource.axd?d=XXX are not being ignored/re-wrote.

Also, it might worth to look at IIS Handlers Mapping configuration to ensure .axd resources are mapped to the standard ISAPI module handler.

1

Try to set causesValidation=false for the button

Augis
  • 1,903
  • 1
  • 16
  • 21
0

There is a bug in the browser definition files that shipped with .NET 2.0 and .NET 4, namely that they contain definitions for a certain range of browser versions. But the versions for some browsers (like IE 10) aren't within those ranges any more. Therefore, ASP.NET sees them as unknown browsers and defaults to a down-level definition, which has certain inconveniences, like that it does not support features like JavaScript.

Fortunately,A hotfix is available for .NET Framework 4.0

https://support.microsoft.com/en-gb/kb/2600088

You can read more about this issue on Scott Hansellman's blog

http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx

Varinder Singh
  • 1,570
  • 1
  • 11
  • 25
  • The hotfix is for .net 4 or 2 only, my system is using 4.5 I've read about this issue and tried to use the hotfix but it can't be installed on .net 4.5 Also, he said he has problem with Chrome, not IE10 – Ziv Weissman May 20 '15 at 07:29
0

I had (almost ) same problem , and it was fixed by reinstalling .Net Framework on the IIS

sino
  • 754
  • 1
  • 7
  • 22