This project is read-only.

javascript error WebForm DoPostBackWithOptions

Jun 18, 2008 at 7:13 PM
Has anyone else noticed that sometimes (I think when a facet name is an integer?) on the first pass the web part returns something like:

javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(quot;ctl11$g_...));

This obviously causes problems with javascript due to the html encoded single quote character becoming "quot;". In looking at the code, it looks like the author is using a LinkButton in the first pass and a Hyperlink in the second pass. I suppose this is for purposes of speed?

In any event, has anyone else seen this? Can you confirm that it happens when the facet name is a number?

I'm going to try fixing this by using the second pass method instead of the first pass method. I imagine I could also maybe fix it by deriving my own class from LinkButton and perhaps overriding the RenderContents method to call the base method and then html unencode it?

Another thought I had was to explicitely set "CausesValidation" to false since I read somewhere that this is what causes LinkButton to flip from _doPostBack to _doPostBackWithOptions??

Any insight into this one is appreciated.
Jun 18, 2008 at 7:28 PM
next version will have Hyperlinks instead of LinkButtons in both runs. Hyperlinks proved to be faster.

gdeckler wrote:
Has anyone else noticed that sometimes (I think when a facet name is an integer?) on the first pass the web part returns something like:

javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(quot;ctl11$g_...));

This obviously causes problems with javascript due to the html encoded single quote character becoming "quot;". In looking at the code, it looks like the author is using a LinkButton in the first pass and a Hyperlink in the second pass. I suppose this is for purposes of speed?

In any event, has anyone else seen this? Can you confirm that it happens when the facet name is a number?

I'm going to try fixing this by using the second pass method instead of the first pass method. I imagine I could also maybe fix it by deriving my own class from LinkButton and perhaps overriding the RenderContents method to call the base method and then html unencode it?

Another thought I had was to explicitely set "CausesValidation" to false since I read somewhere that this is what causes LinkButton to flip from _doPostBack to _doPostBackWithOptions??

Any insight into this one is appreciated.


Jun 18, 2008 at 8:39 PM
Thanks, I modified it to use "FacetLightTemplate" instead of "FacetTemplate" on the first pass and it all seems to be working just fine. BTW, this was the least of the modifications, I have a version now that returns its content as XML and allows you to specify your own XSL for display. Much more versatile. Has some other nifty features as well. I highly recommend that your next version do something along those lines. The XSL method allows you to "stack" search result pages for hierarchical facets and you can also fix the scope switching issues. For example, I have noticed some real peculiarities as far as the search facet web part seems to completely ignore scope. Have run into issues when doing having two scopes, "All" and "People" for example and the people links tend not to work unless you explicitly tell it to search in the People scope. Still hashing out some of the scope issues.

leonidly wrote:
next version will have Hyperlinks instead of LinkButtons in both runs. Hyperlinks proved to be faster.

gdeckler wrote:
Has anyone else noticed that sometimes (I think when a facet name is an integer?) on the first pass the web part returns something like:

javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(quot;ctl11$g_...));

This obviously causes problems with javascript due to the html encoded single quote character becoming "quot;". In looking at the code, it looks like the author is using a LinkButton in the first pass and a Hyperlink in the second pass. I suppose this is for purposes of speed?

In any event, has anyone else seen this? Can you confirm that it happens when the facet name is a number?

I'm going to try fixing this by using the second pass method instead of the first pass method. I imagine I could also maybe fix it by deriving my own class from LinkButton and perhaps overriding the RenderContents method to call the base method and then html unencode it?

Another thought I had was to explicitely set "CausesValidation" to false since I read somewhere that this is what causes LinkButton to flip from _doPostBack to _doPostBackWithOptions??

Any insight into this one is appreciated.





Jun 22, 2008 at 12:15 AM
Edited Jun 22, 2008 at 12:16 AM
next version will have Hyperlinks instead of LinkButtons in both runs. Hyperlinks proved to be faster.

Use of Xsl can be highly benefitial. Please publish your version or contact me directly to have it reviewed for the future release.


gdeckler wrote:
Has anyone else noticed that sometimes (I think when a facet name is an integer?) on the first pass the web part returns something like:

javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(quot;ctl11$g_...));

This obviously causes problems with javascript due to the html encoded single quote character becoming "quot;". In looking at the code, it looks like the author is using a LinkButton in the first pass and a Hyperlink in the second pass. I suppose this is for purposes of speed?

In any event, has anyone else seen this? Can you confirm that it happens when the facet name is a number?

I'm going to try fixing this by using the second pass method instead of the first pass method. I imagine I could also maybe fix it by deriving my own class from LinkButton and perhaps overriding the RenderContents method to call the base method and then html unencode it?

Another thought I had was to explicitely set "CausesValidation" to false since I read somewhere that this is what causes LinkButton to flip from _doPostBack to _doPostBackWithOptions??

Any insight into this one is appreciated.





Dec 15, 2009 at 4:49 PM
Edited Jan 5, 2010 at 4:41 PM

Having control like this over Facet Template's or the ability to do our own XSLT for controlling HTML display would be so much better than the javascript hack we're trying to use.  We are modifying the facets (after the page completes) & inserting them into our own tables (yuck) so that we can stylize them (to categorize them & expand/contract sections).  This is messy, of course & we also can't find the right event to hook... for when the Facet progress bars complete!

Two Questions for leonidly, et al:

1. What is the right EVENT to hook for when the Facet progress bars have completed their alterations to the HTML? (right now, "onreadystatechange" fires before the bar completes & our changes to the page get wiped out!) Help!
    [UPDATE: For now, we look to see when the progress bar completes, via DOM... and then reformat the html, but this results in quite a delay from the user's view.  Not acceptible.]

2. Is there a way to, instead, use the built-in facet Template system (i.e. FacetTemplate, HeaderTemplate, SeparatorTemplate, FacetLightTemplate)?