Hyperlink control set NavigateUrl in code behind causes javascript error

  1. #1

    Hyperlink control set NavigateUrl in code behind causes javascript error


    since we update from Ext.NET 2.3.1 to Ext.NET 2.4.0 we have a problem with the ext hyperlink control. We set the NavigateUrl in the code behind, it worked in 2.3.1, but not in 2.4.0! It causes a javascript error in the function
    because this.textEl is undefined..

    Maybe it's a bug? Any idea?

    Last edited by Daniil; Dec 12, 2013 at 4:18 PM. Reason: Please use [CODE] tags
  2. #2
    Hi @Willimaendu,

    Thank you for the report, but I cannot reproduce. Could you provide a test case, please?

    Here is my test case.

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
            if (!X.IsAjaxRequest)
                this.HyperLink1.NavigateUrl = "http://ext.net";
        protected void Set(object sender, DirectEventArgs e)
            this.HyperLink1.NavigateUrl = "http://ext.net/blog";
    <!DOCTYPE html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:HyperLink ID="HyperLink1" runat="server" Text="HyperLink" />
            <ext:Button runat="server" Text="Change NavigationUrl" OnDirectClick="Set" />
  3. #3

    ok, we have a page which looks like that:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Test" %>
    <asp:Content ContentPlaceHolderID="MainContent" runat="server">
        <ext:Container runat="server">
                <ext:HBoxLayoutConfig Align="Stretch" />
                <ext:Container runat="server" Width="400" Layout="VBoxLayout">
                        <ext:VBoxLayoutConfig Align="Stretch" />
                        <ext:TreePanel ID="OtvVerkehrTreePanel" ClientIDMode="Static" runat="server" RootVisible="False" Animate="False" AutoScroll="True" Flex="1" Cls="tree-panel">
                                <ext:Toolbar runat="server">
                                        <ext:Button runat="server" ID="btnImport" Icon="TableRefresh" ToolTip="<%$ Resources:Site, Import %>">
                                                <Click OnEvent="Import" Failure="Ext.MessageBox.alert(loadFailed, errorDuringAjaxEvent);" />
    							<ext:ModelField Name="Bezeichnung" />
    								<ext:TreeColumn runat="server" DataIndex="Bezeichnung" Flex="1" Sortable="true" Text="<%$ Resources:Test, Bezeichnung %>" />
                                <ext:TreeView runat="server" ToggleOnDblClick="false" />
        <uc:DataImport ID="DataImportUserControl" runat="server" />
    And we have a user control which is being called from the page:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DataImport.ascx.cs" Inherits="UserControls.DataImport" %>
    <ext:Window ID="winDataImport" runat="server" Width="500" BodyStyle="height:auto; background:white;" Hidden="true" Resizable="false" Modal="true" Layout="FitLayout">
            <ext:FormPanel ID="pnlDataImport" runat="server" BodyPaddingSummary="5" DefaultAnchor="0" BodyStyle="border:0">
                    <ext:Parameter Name="LabelWidth" Value="125" Mode="Raw" />
                    <ext:Hidden ID="hidImporttyp" runat="server" />
                    <ext:FieldContainer ID="fctTemplate" runat="server" FieldLabel="<%$ Resources: Site, Template %>">
    		                <ext:HyperLink runat="server" ID="lnkTemplate" />
    				<ValidityChange Handler="#{btnImport}.setDisabled(!valid);" />
            <ext:Button runat="server" ID="btnImport" Disabled="True" Icon="Add" Text="<%$ Resources:Site, Import %>">
                    <Click OnEvent="Import" Failure="Ext.MessageBox.alert(loadFailed, errorDuringAjaxEvent);" />
            <ext:Button runat="server" ID="btnCancel" Icon="Decline" Text="<%$ Resources:Site, Cancel %>">
                    <Click Handler="#{winDataImport}.hide(null);"/>
    In the code behind of the page we have the event handler Import which looks like that:

    public void Import(object sender, DirectEventArgs e)
    	catch (Exception ex)
    		MessageBox.ShowError(Resources.Site.Error, Resources.Site.ErrorGeneralMessage, ex.Message);
    And in the user control the show method looks like that:

    public void Show(string templateUrl = "")
    	fctTemplate.Visible = !string.IsNullOrWhiteSpace(templateUrl);
    	if (!string.IsNullOrWhiteSpace(templateUrl))
    		lnkTemplate.NavigateUrl = templateUrl;
    		lnkTemplate.Text = Path.GetFileName(templateUrl);
    Can you reproduce it? Is there a fix?

    Kind regards
  4. #4
    I cannot reproduce.

    Do you have an online test case?

Similar Threads

  1. [CLOSED] Javascript error when running ext.net code in IE9 iframe
    By livehealthierGF in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Jun 17, 2013, 10:12 PM
  2. change HyperLink NavigateUrl by Java Script
    By BLOZZY in forum 1.x Help
    Replies: 2
    Last Post: Aug 09, 2011, 11:32 AM
  3. [CLOSED] Set NavigateURL on HyperLink during a DirectEvent
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 04, 2011, 8:31 PM
  4. Replies: 3
    Last Post: Oct 16, 2010, 8:01 AM
  5. [CLOSED] [1.0] Javascript error when loading usercontrol from code
    By klaus.schwarz in forum 1.x Legacy Premium Help
    Replies: 17
    Last Post: Jul 12, 2010, 3:59 PM

Posting Permissions