Nevron Forum

'NClientHost' is undefined Error

https://www.nevron.com/Forum/Topic8382.aspx

By Christopher Butler - Friday, December 27, 2013

Hi,

We have a Nevron control which is throwing a client-side error, "'NClientHost' is undefined."  In IE9 developer tools the offending line looks like this:

 

<div id='NThinDiagramControl1' style='margin:0;padding:0;overflow:visible;position:relative;font-size:0px;width:1400px;height:1000px'><script type='text/javascript'>{var host = new NClientHost($("div[id = 'NThinDiagramControl1']")[0],"NThinDiagramControlHttpHandler.axd","http://<<<WEB PAGE PATH SHOWS HERE>>>.aspx",new NDiagramCommandProcessor(),new NRect(0, 0, 1400, 999));;

var request = NRequest.GetUpdateScriptRequest();

host.ExecuteServiceRequest(request);

}<

 

Thus far we have checked the following things, and have been so far unable to determine the cause.

- Tried adding jQuery reference directly to the top of the page:  <script src="Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
- Tried leaving JQuery.SourceType setting as default (unset), "none", and "embedded" to no avail.
- Verified the handlers section in the web.config file as follows:

 

    <httpHandlers>
      <add path="NevronDiagram.axd" verb="*" type="Nevron.Diagram.WebForm.NDiagramImageResourceHandler" validate="false"/>
      <add path="NevronChart.axd" verb="*" type="Nevron.Chart.WebForm.NChartImageResourceHandler" validate="false"/>
      <add path="NevronScriptManager.axd" verb="*" type="Nevron.UI.WebForm.Controls.NevronScriptManager" validate="false"/>
      <add path="NThinDiagramControlHttpHandler.axd" verb="*" type="Nevron.Diagram.ThinWeb.NThinDiagramControlHttpHandler" validate="false"/>
      <add path="NAspNetThinWebControlHttpHandler.axd" verb="*" type="Nevron.ThinWeb.NAspNetThinWebControlHttpHandler" validate="false"/>
    </httpHandlers>

...

    <handlers>
      <!--If you are using Nevron Chart for .NET-->
      <remove name="NevronChart"/>
      <!--If you are using Nevron Diagram for .NET-->
      <remove name="NevronDiagram"/>
      <!--If you are using Nevron Chart for .NET-->
      <remove name="NevronScriptManager"/>
      <remove name="NThinDiagramControlHttpHandler"/>
      <remove name="NAspNetThinWebControlHttpHandler"/>
      <add name="NevronChart" preCondition="integratedMode" verb="*" path="NevronChart.axd" type="Nevron.Chart.WebForm.NChartImageResourceHandler"/>
      <!--If you are using Nevron Diagram for .NET-->
      <add name="NevronDiagram" preCondition="integratedMode" verb="*" path="NevronDiagram.axd" type="Nevron.Diagram.WebForm.NDiagramImageResourceHandler"/>
      <add name="NevronScriptManager" preCondition="integratedMode" verb="*" path="NevronScriptManager.axd" type="Nevron.UI.WebForm.Controls.NevronScriptManager"/>
      <add name="NThinDiagramControlHttpHandler" preCondition="integratedMode" verb="*" path="NThinDiagramControlHttpHandler.axd" type="Nevron.Diagram.ThinWeb.NThinDiagramControlHttpHandler"/>
      <add name="NAspNetThinWebControlHttpHandler" preCondition="integratedMode" verb="*" path="NAspNetThinWebControlHttpHandler.axd" type="Nevron.ThinWeb.NAspNetThinWebControlHttpHandler"/>
    </handlers>

 

 

We are curious how to resolve this issue or troubleshoot it any further.  Please advise, thanks!

-Chris

 

By Nevron Support - Friday, December 27, 2013

Hi Chris,

Most likely the NAspNetThinWebControlHttpHandler is not registered correctly. To check if this is the case open the page containing the diagram using Firefox with enabled FireBug and then on the .NET tab check if there are any requests to this http handler that fail.

You can also send an e-mail to support@nevron.com to schedule an online web meeting and we'll take a look at this problem...
By Christopher Butler - Wednesday, January 15, 2014

Hi,

 

For anyone this might help, my error was being caused by my C# code setting the .Visible property of the NThinDiagramControl to false.
What worked for me instead is wrapping the control inside a div tag, and then using jQuery to hide the div. There are probably other ways as well.

 

ASPX:


<
div class="nevronPanel" >
  <nevron:nthindiagramcontrol runat="server" id="NThinDiagramControl1" Width="500px" Height="500px"></nevron:nthindiagramcontrol>
</div>

And in code-behind, register startup script similar to this if the control should not display:

$(document).ready( function() { $(".nevronPanel").hide(); });

 

Thanks,
-Chris