Title Back Colour Keyoti Title Line Title Curve
Blue Box Top

asp.net control behavior in non-IE browsers - SearchUnit - Forum

Welcome Guest Search | Active Topics | Log In | Register

Options
notnet
#1 Posted : Monday, February 1, 2016 10:42:56 PM
Rank: Member

Groups: Registered

Joined: 1/29/2016
Posts: 10
I am trying a simple two-page search (search box and results on separate pages) using asp.net controls. The search box shows up properly in all cases and does post back, but the call to the result page only includes the value for the QueryExpr parameter in Internet Explorer. In other cases (current versions of Firefox, Chrome, Safari), it is an empty string.

Are there known issues with the control version and current browsers?

Thanks!
Jim
#2 Posted : Tuesday, February 2, 2016 1:02:53 AM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
It's working properly for me in Chrome - can you share some code to see how you're doing it please?

Jim
-your feedback is helpful to other users, thank you!


notnet
#3 Posted : Tuesday, February 2, 2016 3:05:37 PM
Rank: Member

Groups: Registered

Joined: 1/29/2016
Posts: 10
I'm starting with the simplest implementation I can, so I register the control with:
Code:
<%@ Register TagPrefix="searchengine" Namespace="Keyoti.SearchEngine.Web"
Assembly="Keyoti4.SearchEngine.Web" %>

and include the control with:
Code:
<searchengine:searchbox id="SearchBox1" runat="server"
  ResultPageURL="~/search.html"/>


Here is the html output by the control in Chrome:
Code:
<span id="SearchBox1"><script type='text/javascript'>var sew_WMSSearchBox1=false;var sew_WML = window.onload; window.onload=function(){if(typeof(sew_WML)=='function')sew_WML();var t=document.getElementById('');sew_OC['']=t.style.color;if(t.value==''){t.style.color='#8C8C8C';t.value='Search'; sew_WMSSearchBox1=true;}}</script><input type='text' value="" onblur="if(this.value==''){this.style.color='#8C8C8C';this.value='Search';sew_WMSSearchBox1=true;}" onfocus="if(sew_WMSSearchBox1){this.value='';this.style.color='';sew_WMSSearchBox1=false;}" id="" style="vertical-align:middle;" onkeypress="if(event)if (event.keyCode) if( event.keyCode==13){if(event.preventDefault)event.preventDefault();if(typeof(sew_WMSSearchBox1)!=&#39;undefined&#39; &amp;&amp; sew_WMSSearchBox1){document.getElementById(&#39;&#39;).value=&#39;&#39;;}__doPostBack(&#39;ctl00$SecondaryContent$SearchBox1&#39;,&#39;&#39;);return false;}" name="" /><input type='button' value="Search" id="" style="vertical-align:middle;" onclick="if(typeof(sew_WMSSearchBox1)!=&#39;undefined&#39; &amp;&amp; sew_WMSSearchBox1){document.getElementById(&#39;&#39;).value=&#39;&#39;;}__doPostBack(&#39;ctl00$SecondaryContent$SearchBox1&#39;,&#39;&#39;)" name="" /></span>


In the Console, Chrome reports this error:
Uncaught TypeError: Cannot read property 'style' of null

Similarly, Firefox reports this:
TypeError: t is null

I should also mention this is running on IIS7 on Windows 7 Pro (64bit), and the site targets .NET 4.5.1.
Jim
#4 Posted : Tuesday, February 2, 2016 6:10:42 PM
Rank: Advanced Member

Groups: Administrators, Registered

Joined: 8/13/2004
Posts: 2,669
Location: Canada
Thanks, are you setting ClientIDMode in your page at all?

There are somethings that I'm unclear on.

1. How are you running our SearchResult control in a HTML page? ResultPageURL="~/search.html"

2. The output here is weird
Code:

var t=document.getElementById('');

the server control is supposed to output var t=document.getElementById('<ClientID>');, but somehow the ClientId of the control is empty - I've seen a couple of instances on the net relating to parent and child controls. Could you give me some context as to where the SearchBox control is housed? Also, is it in controls that are added dynamically? During which page event are they added?

I'm guessing you either have ClientIDMode set to something other than default (which we should handle, but perhaps are not) or you have SearchBox inside a control that is added late in the page lifecycle and for some reason the ClientID isn't being assigned.

Thanks
Jim
-your feedback is helpful to other users, thank you!


notnet
#5 Posted : Tuesday, February 2, 2016 6:37:26 PM
Rank: Member

Groups: Registered

Joined: 1/29/2016
Posts: 10
The control is in a Content control (e.g. for placeholder) on a page using a master page.

I have ClientIDMode set to AutoID in web.config, but the ContentPlaceHolder in the master page is set to Static, so the control by default inherits that.

When I set ClientIDMode on the control itself to either Predictable or AutoID, it works properly, which is fine for me.

Thanks for drawing my attention to that.




Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.




About | Contact | Site Map | Privacy Policy

Copyright © 2002- Keyoti Inc.