Hi
We have a problem when inserting some ultrawebeditor into an UpdatePanel, and we tried to hide/show it throw AJAX server side event.
Example:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" Visible="False">
<igtxt:WebPercentEdit ID="WebPercentEdit1" runat="server">
</igtxt:WebPercentEdit>
</asp:Panel>
<asp:Label ID="Label1" runat="server" Text="This is a label!"></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Click Me" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
C# code:
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "hi" + DateTime.Now.ToString();
this.Panel1.Visible = true;
}
At this point client side generate the exception:
Error: Sys.ScriptLoadFailedException: The script ‘if_res/js/ig_shared.js'...
If "Panel1" is visible = true, this behavior does not occurred.
Thank's
Jaimir G.
Hi Jeff,
Infragistics controls should render their scripts from embedded resources without any custom settings in application.If application wants to have explicit local js files, then it has 2 options.Note: that is supported only by Infragistics.WebUI, but not by Ifragistics.Web.UI.
1. Use javascriptdirectory in webconfig.
2. Set JavaScriptXxx properties for each control used by page/application. That can be done within aspx or within codes behind. However, application should ensure that location of ig_shared.js is exactly the same for all controls which depend on it. Example, for tree:
protected void Page_Load(object sender, EventArgs e){ this.UltraWebTree1.JavaScriptFilename = Infragistics.JScriptDir + "ig_tree.js"; this.UltraWebTree1.JavaScriptFileNameCommon = Infragistics.JScriptDir + "ig_shared.js";}
I am having this issue today and what I would like to do is be able to get to the Infragistics path that is in the web.config file.
<infragistics.web imageDirectory="~/Infragistics/Images/" javaScriptDirectory="~/Infragistics/20111CLR35/Scripts/" />
Is there an infragistics method available to get to the javaScriptDirectory? I want to code the fix you have using the RegisterScriptInclude but I don't want to hard code the path to the scripts directory.
Somethine like: RegisterClientScriptInclude(this, this, "sharedKey", Infragistics.JScriptDir + "ig_tree.js").....etc
Thanks!
jeff
Hi Jaimir,
Now I understand what happens. There is no need to submit a bug report to Infragistics.
The Infragistics controls in order to enable their client script under ScriptManager (AJAX) use theSystem.Web.UI.ScriptManager.RegisterClientScriptIncludemethod. But if script is not embedded in dll and it was not registered on full postback, then ScriptManager has issues with processing that new resource. You can verify that by following:
1. Create a simple "test.js" file which contains something like alert('test.js') or leave it blank, it does not matter what it has.2. Remove percent editor from your test page and keep only panels and button.3. Process OnPreRender event of Page and register that file conditionally (when UpdatePanel gets visible).4. Run page, click a button which shows UpdatePanel and get the same exception as with percent editor (or any other control which uses local js resources).
Below is cs codes:
protected override void OnPreRender(EventArgs e){ if(this.UpdatePanel1.Visible) System.Web.UI.ScriptManager.RegisterClientScriptInclude(this.UpdatePanel1, this.UpdatePanel1.GetType(), "myKey", "test.js"); base.OnPreRender(e);}
If the only Infragistics controls used by your applications is that editor in initially hidden UpdatePanel, then you may try to get around that by explicit registration of js files used by editor. If your application uses controls created on initial load or full postback, then similar approach can bring problems, because it will lead to double instances of same js files (worst case with ig_shared.js). Example to fix that specific page with editor located in UpdatePanel1:
protected override void OnPreRender(EventArgs e){ if(!this.UpdatePanel1.Visible) { System.Web.UI.ScriptManager.RegisterClientScriptInclude(this.UpdatePanel1, this.UpdatePanel1.GetType(), "sharedKey", "ig_res/js/ig_shared.js"); System.Web.UI.ScriptManager.RegisterClientScriptInclude(this.UpdatePanel1, this.UpdatePanel1.GetType(), "editKey", "ig_res/js/ig_edit.js"); } base.OnPreRender(e);}
Hi Viktor,
I will submit a bug report.
I tested those codes with a page located in FileSystem website and it worked without problems. I tested various latest and old versions of CLR2.0 and CLR3.5 dlls in VisualStudio 2005 and 2008. The only problem with javascript which I found were in versions built before 7.1. If that is what you use, then I suggest you to update NetAdvantage with newer version. If you have recent version, then probably configuration of my test project was different from yours. I suggest you to submit a bug report with a sample project: http://es.infragistics.com/support/ask-for-help.aspx