I have a web part in which I want to use the TreeView. I am creating the controls in code during the CreateChildControls. When the page renders I get the error:
Script controls may not be registered before PreRender
In CreateChildControls I am doing the following:
rsm = new RadScriptManager();
rsm.ID = "rsm";
this.Controls.Add(rsm);
rtv = new RadTreeView();
rtv.ID = "rtv";
this.Controls.Add(rtv);
My OnPreRender is calling base.OnPreRender
I have ensured the SafeControls entry and HttpHandler entries are in the web.config and also made sure the Telrik DLLs are in the GAC.
I am sure I am missing something simple but can't figure it out.
Thanks,
Raman
Script controls may not be registered before PreRender
In CreateChildControls I am doing the following:
rsm = new RadScriptManager();
rsm.ID = "rsm";
this.Controls.Add(rsm);
rtv = new RadTreeView();
rtv.ID = "rtv";
this.Controls.Add(rtv);
My OnPreRender is calling base.OnPreRender
I have ensured the SafeControls entry and HttpHandler entries are in the web.config and also made sure the Telrik DLLs are in the GAC.
I am sure I am missing something simple but can't figure it out.
Thanks,
Raman
7 Answers, 1 is accepted
0
Raman
Top achievements
Rank 1
answered on 30 Apr 2008, 08:28 PM
I was able get past this by adding the following to my OnInit
protected override void OnInit(EventArgs e)
{
if (ScriptManager.GetCurrent(this.Page) == null)
{
rsm = new RadScriptManager();
rsm.ID = "rsm";
this.Controls.Add(rsm);
}
base.OnInit(e);
}
The tree now renders but I can't expand or collapse any nodes.
protected override void OnInit(EventArgs e)
{
if (ScriptManager.GetCurrent(this.Page) == null)
{
rsm = new RadScriptManager();
rsm.ID = "rsm";
this.Controls.Add(rsm);
}
base.OnInit(e);
}
The tree now renders but I can't expand or collapse any nodes.
0
Hi Raman,
Does your code allow the TreeView instance to be created and added to the controls collection in the OnInit override too? If so, could you try that? If not possible you can add an EnsureChildControls call to an OnLoad override - this will ensure that the CreateChildControls method is called in an earlier stage of the page life.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Does your code allow the TreeView instance to be created and added to the controls collection in the OnInit override too? If so, could you try that? If not possible you can add an EnsureChildControls call to an OnLoad override - this will ensure that the CreateChildControls method is called in an earlier stage of the page life.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Hi Raman,
I just wanted to note that you should add the Telerik.Web.UI.WebResource handler to the application web.config to use the RadScriptManager.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I just wanted to note that you should add the Telerik.Web.UI.WebResource handler to the application web.config to use the RadScriptManager.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Raman
Top achievements
Rank 1
answered on 02 May 2008, 07:38 PM
Erjan,
I added the Telerik entries to the web.config but I found that I also needed to add the ASP.Net Ajax entries as well. That is in your documentation but not part of the integration guide on SharePoint so I didn't realize that it was needed (or I just missed it in your document).
It's working in IE now but not in FireFox. In FireFox the tree renders but you can't expand the nodes and clicking on the text doesn't fire any events. Are there known problems with FireFox?
Thanks,
Raman
I added the Telerik entries to the web.config but I found that I also needed to add the ASP.Net Ajax entries as well. That is in your documentation but not part of the integration guide on SharePoint so I didn't realize that it was needed (or I just missed it in your document).
It's working in IE now but not in FireFox. In FireFox the tree renders but you can't expand the nodes and clicking on the text doesn't fire any events. Are there known problems with FireFox?
Thanks,
Raman
0
Hi Raman,
We are in the process of updating the RadControls in SharePoint instructions, as the current ones are specific for RadControls "Classic". Thanks for pointing this out.
As per the treeview not working in FireFox - we haven't observed any problems there. Can you check if there are any errors in the JavaScript console?
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
We are in the process of updating the RadControls in SharePoint instructions, as the current ones are specific for RadControls "Classic". Thanks for pointing this out.
As per the treeview not working in FireFox - we haven't observed any problems there. Can you check if there are any errors in the JavaScript console?
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Raman
Top achievements
Rank 1
answered on 06 May 2008, 02:15 AM
Hi Erjan,
There are no javascript errors in the console but there are CSS errors:
"Error in parsing value for property display. Declaration dropped.
"Error in parsing value for property display. Declaration dropped.
"Error in parsing value for property display. Declaration dropped.
There are no javascript errors in the console but there are CSS errors:
"Error in parsing value for property display. Declaration dropped.
.RadTreeView div.rtIn
{
display:-moz-inline-block;
display:inline-block;
vertical-align:top;
}
"Error in parsing value for property display. Declaration dropped.
* html .RadTreeView div.rtIn
{
display:inline-block;
}
"Error in parsing value for property display. Declaration dropped.
.RadTreeView .rtSp
{
display: -moz-inline-box;
display: inline-block;
width: 1px;
vertical-align: middle;
}
"Error in parsing value for property display. Declaration dropped.
.RadTreeView .rtPlus,
.RadTreeView .rtMinus
{
font-size:0;
padding:0;
display: -moz-inline-box;
display:inline-block;
vertical-align:top;
cursor: pointer;
}
In addition, in IE if I try to add a ContextMenu to the tree I get the following error:
"_onSubmitStatements" is null or not an object"
Please let me know what additional information or details I can provide you.
Thanks,
Raman
0
Hi Raman,
It got clearer now. The
If you don't need Ajax calls and you need the ScriptManager control located in an invisible control, you can set its EnablePartialRendering property to false.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
It got clearer now. The
"_onSubmitStatements" is null or not an object"error typically happens when the ScriptManager/RadScriptManager hasn't output the PageRequestManager initialization script. Can you check if the control, to which Controls collection you add the ScriptManager control (or any of its parent controls) has its Visible property set to false?
If you don't need Ajax calls and you need the ScriptManager control located in an invisible control, you can set its EnablePartialRendering property to false.
Kind regards,
Erjan Gavalji
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center