Basically I have WebHtmlEditor and WebCurrenty Editor in a usercontrol which for testing i called "ctlEditOffer", that control is hidden by default:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<uc1:ctlEditOffer ID="ctlEditOffer1" runat="server" Visible="false" />
</ContentTemplate>
On the code behind for Button1 is the following code:
When Button1 is clicked, it correctly shows the control with the Infragistics editors, along with a javascript error "Object Expected"
so basically you cannot do anything with the infracontrols.
What I think its happening is not loading the javascript files required for the controls if there are in a UpdatePanel, any ideas?
Thanks
My editor is visible from page load and i still have the issue. I have tried adding duplicate controls outside of the update panel and that didn't work either as suggested. I will try registering each js file.
This issue has to do with when the control's JavaScript gets registered.
When you set a control's Visible property to false, it is not rendered to the HTML sent to the browser when the page is first requested. Not only does the user control not appear on the page, it essentially "doesn't exist" as far as the page is concerned.
When you click the button, you're doing an AJAX callback through the UpdatePanel. This renders the HTML for the user control and its child controls. UpdatePanel can't also send along the JavaScript for our editors, however, since our editors register their JavaScript in the HEAD element of the page.
The best solution is to hide your user control using CSS, rather than using the Visible property. By doing this, the user control will still be rendered to the HTML of the page, including the JavaScript for our controls. This will allow our controls to function in this scenario.
Another option is to find some other way to register the JavaScript for our controls, such as by manually referring to the correct JavaScript files, or having another (hidden) instance of each of the relevant controls outside of the UpdatePanel.
Has there been a solution to this? This appears to be an issue.
I see the same behavior. If I have currencyedit or numericedit fields inside an AJAX updatepanel, then the javascript doesn't load or work properly if they are not visible when the page first loads. For me, I have a gridview that defaults to view only. The user clicks Edit to open the details in a formview and the infragistic editors won't work there.
If I add an example of each infragistic editor control to the top of my usercontrol and make sure they are visible at the start, then the controls will end up working correctly when they are dynamically rendered later on. Is there any other way to force them to load?
Ivan,
To reproduce the problem just add visible="false" to the control like:
<uc1:WebUserControl ID="WebUserControl1" runat="server" Visible="false" />
By default the usercontrol should not be visible.
The button click event should just be WebUserControl1.Visible = true;
Thanks,
Valentin