Dear all,
I use Panelbar on one of my user-controls which I placed in a pane of radsplitter on a master-page.
This panelbar is Ajaxified with other panel on the master-page.
I have a method (loadusercontrol) on the master-page that is called by this panelbar via (OnItemClicked) server side method, everything was fine until I notice that the method is called whenever I clicked on panelbar root-item or item, and I wanted to change this that the method is called on clicking the items only.
So, I think of doing this via client-side script, so I created a javascript method OnClientItemClicking="panelclicked" to handle this situation as follows:
| <telerik:RadCodeBlock ID="CB1" runat="server"> |
| <script type="text/jscript" language="javascript"> |
| function panelclicked(sender, e) |
| { |
| var panelBar = $find("<%= navpanelBar.ClientID %>"); |
| var item = panelBar.findItemByText(e.get_item().get_text()); |
| if (item) |
| { |
| if item.get_text() == "AVT data" |
| { |
| "<% MasterP.LoadUserControl("MainDataEntry.ascx", MasterP.MainPanel); %>" |
| } |
| else |
| { |
| } |
| } |
| } |
| </script> |
| </telerik:RadCodeBlock> |
"Script controls may not be registered after PreRender"
This error appear on the loadusercontrol method of the master-page:
| public void LoadUserControl(string controlName, Control parent) |
| { |
| parent.Controls.Clear(); |
| UserControl MyControl = (UserControl)LoadControl(controlName); |
| string userControlID = controlName.Split('.')[0]; |
| MyControl.ID = userControlID.Replace("/", "").Replace("~", ""); |
| parent.Controls.Add(MyControl); |
| CurrentControl = controlName; |
| } |
at that line : parent.Controls.Add(MyControl);
any advice in this situation ...
Thanks and best regards
Waleed