Hi,
We have a requirement to render a page in edit mode and read only mode.
The RAD controls that we are using are custom classes that inherits from Rad control classes. For example we have a class called CSRadComboBox that extends from the class RadComboBox and we use the instances of class CSRadComboBox in all the code for the project.
When a page is rendered in the read-only mode to the users, we override the Render method of the RadComboBox and render an System.Web.UI.WebControls.Label object with the contents in it. I have copy pasted the code used to render in the readonly mode for one of the controls below.
We have a problem in the readonly pages that there are lot of javascript error that is thrown, "null is null or not an object" and when debugged in visual studio, we could make out that the ajax javascript from the telerik resource is trying to attach events to the labels that has been entered and since it is not able to find the actual control, the javascript error is being thrown.
We need help on how to disable javascript for individual rad controls in the readonly view of the page when actually it is not required at all.
Thanks,
Manoj
We have a requirement to render a page in edit mode and read only mode.
The RAD controls that we are using are custom classes that inherits from Rad control classes. For example we have a class called CSRadComboBox that extends from the class RadComboBox and we use the instances of class CSRadComboBox in all the code for the project.
When a page is rendered in the read-only mode to the users, we override the Render method of the RadComboBox and render an System.Web.UI.WebControls.Label object with the contents in it. I have copy pasted the code used to render in the readonly mode for one of the controls below.
protected override void Render(HtmlTextWriter writer)
{
if (IsReadOnly)
{
Label lblValue = new Label();
string display = "--";
if (!string.IsNullOrEmpty(this.SelectedText))
{
display = this.SelectedText;
}
lblValue.Text = display;
lblValue.RenderControl(writer);
}
else
{
base.Render(writer);
}
}
We have a problem in the readonly pages that there are lot of javascript error that is thrown, "null is null or not an object" and when debugged in visual studio, we could make out that the ajax javascript from the telerik resource is trying to attach events to the labels that has been entered and since it is not able to find the actual control, the javascript error is being thrown.
We need help on how to disable javascript for individual rad controls in the readonly view of the page when actually it is not required at all.
Thanks,
Manoj
Were you able to overcome this issue?
The suggested approach by Peter is still applicable: EnableEmbeddedScripts="false".
Thanks Ruben for responding. EnableEmbeddedScripts="false" method didn't work for me. I added another approach that worked out well for me. Added in the Answer section below
Thank you for sharing your solution with the community, Ravishankar! This is much appreciated!