Am using Telerik Grid control in one of my web page. In this telrik grid to edit the Grid row am Using EditForm User control
Please see below my code
And I turn ON the Validate Request property in my web config file But one of the text box inside my User control i want to allow HTML tags. Ex: <ADV> this is a sample advertisement </ADV>
When I type above text its giving me "Potentially dangerous request" error. which is correct because i turn ON validate Request property in the web config file.
But In My case I want to overcome this problem for a single text box which am using in my UserControl.
Could you please help me how can I allow Unsafe Script to one text box with out chnaging my web config ValidateRequest property...
8 Answers, 1 is accepted
Unfortunately you cannot validate partially the input from the browser when the ValidationRequest is set to "true". I will suggest you turn off it for the current page. Here is a code snippet showing how to achieve this:
Additionally if you need to validate the input you need to accomplish this task by hand.
the Telerik team
Hi Telerik Team,
What you said was correct.
But i dont want to turn off my ValidateRequest=False. Because in this control i have another textboxes. for those textboxes i don't want to allow user to type unsafe script. I just want to allow user to type unsafe script in only one textbox.
For this purpose I already wrote a code and mapped in web config file to overcome this unsafe script for a particular textbox,
All are working fine. But when i come to Telerik Grid EditFormSettings it's not working. Every page i apply the code example like below.
Assume am using TextBox1 inside my editform settings user control
After I run my web page and when i go and right click > ViewSource > I can't see clientID for this textbox.
Could you please help me where should i go and apply this script to overcome my problem ...
Please help me am working in this from past 1 and half week ....
It is expected the control placed in the EditFormSettings not to be rendered on the page when RadGrid is not in edit mode. The edit form is build dynamically and to get the client id of the control you need to wire the ItemCreated event. In it you need to check whether the passed e.Item is GridEditableItem. When this condition is true you can find the required textbox and get its client id. For further information you can examine this online help article devoted on the same matter.
the Telerik team
Thank you very much for your reply.
What I search in the Forums I got this code and I also applied in the Grid Item Created event .Inside this I check whether the passed e.Item is GridEditableItem and i can get client ID of my TextBox. But my problem was implementing the below code.
Example : Default1.aspx page I have Textbox1, textBox2, Label, Button, DropDownListBox. Web config file i set validateRequest="true"
My requirement : I should eneter HTML tags inside the Textbox.
|The above code was working fine for all pages.
When I come Telerik Grid Using <EditFormSettings> using User control.
My Telerik Grid page name was : Default2.aspx (Having TelerikGrid, Button, DropDownBOc,RadCalendar)
My UserControl Page was : UserControl1.ascx
On Item Created event i can generate Client ID of the TextBox. But the above code I applied in UserControl1.ascx. No build error but when i try to do any postback events for other controls (Button click,DropDown SelectedIndex Changed) which am using in Default2.aspx. Its giving "Potentially dangerous Request error."
I also understand that After Run the whole web application I go to Default1.aspx > Right Click > Go to View Source > I can see client ID of TextBox1
But If I go to Defaul2.aspx > Click Inside TelerikGrid Edit Button > User Control opens to edit >Right Click > Go to View Source > I can't see client ID.
Please give me advice where should i go and apply my above function for UserControl1.ascx textbox.
For further information how to reference the edit form review this help article.
the Telerik team
What you given was working very good and fine. Thank you very much for your help.
But am facing another problem.
I have Default1.aspx and TelerikGrid.ascx and EditForm.ascx .
TelerikGrid.ascx : This page contains telerik grid. inside telerik grid in Edit Form settings am calling EditForm.ascx. Please see sample code below Default1.aspx : Inside this page am calling TelerikGrid.ascx user control.
Case : 1
When i implement in my project the above logic
Run default1.aspx> Click Edit Image in Grid > Right Click on Web Interface > Click View Soure > i can't see EditForm Controls IDs in view source
Case : 2
When i implement same above logic for Test project
Run default1.aspx> Click Edit Image in Grid > Right Click on Web Interface > Click View Soure > i can see EditForm Controls IDs in view source
In my project am using Radwindow Manager and Rad Ajax Panel and RadContent Manager . Could you please give me a idea why its not generating View source. Because of this what ever i apply Page.Form.Attributes("onsubmit") it's not firing..
Can you give me a suggestion what could be the reason View source can't generated for EditForm User Control in my web application...
Please help me ......
Here for your understanding I attach the files . Pleas elook at it.
2. Inbox.Aspx (Which is the one calling DataGridControl.ascx)
3. dataGridControl.ascx (is my usercontrol which having editform.ascx settings)
4.EditForm.ascx is the one am calling inside rad Grid
Could you please guide me how to attach files to this forum
In order to attach the required files I will suggest you open a regular support ticket and send them to us. Thus I will be able to investigate the problem and advise further.
the Telerik team