This question is locked. New answers and comments are not allowed.
Hello,
I'm trying to use javascript validation (using xVal):
but I'm getting error "xVal is not defined" which is understandable because it is being added at the end of the file where I'm running Render() function. When I try to run Render() in page head section Telerik Menu and PanelBar are not working (I'm not getting any JS errors in Firefox and other scripts are working -> xVal too). Any ideas how to fix this issue?
Thanks
I'm trying to use javascript validation (using xVal):
| <%= Html.ClientSideValidation("contactform", typeof(ContactForm)) %> |
but I'm getting error "xVal is not defined" which is understandable because it is being added at the end of the file where I'm running Render() function. When I try to run Render() in page head section Telerik Menu and PanelBar are not working (I'm not getting any JS errors in Firefox and other scripts are working -> xVal too). Any ideas how to fix this issue?
Thanks
4 Answers, 1 is accepted
0
Hello GrZeCh,
You can move the ScriptRegistrar to the top (where you want jQuery to be available) and include the grid and menu scripts manually at the end of the page. This is not advised from a performance point of view (i.e. you should always include the scripts at the bottom of the page) - yet I am not aware if xVal has some way of delayed startup.
Kind regards,
Alex
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can move the ScriptRegistrar to the top (where you want jQuery to be available) and include the grid and menu scripts manually at the end of the page. This is not advised from a performance point of view (i.e. you should always include the scripts at the bottom of the page) - yet I am not aware if xVal has some way of delayed startup.
Kind regards,
Alex
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
GrZeCh
Top achievements
Rank 2
answered on 19 Nov 2009, 03:13 PM
I was trying to do something like this:
but this is not showing in page source in browser.
| <% Html.Telerik().ScriptRegistrar() |
| .OnDocumentReady(() => |
| { |
| Html.ClientSideValidation("contactform", typeof(ContactForm)); |
| }); |
| %> |
but this is not showing in page source in browser.
0
Hi GrZeCh,
It should be like this:
<% Html.Telerik().ScriptRegistrar()
.OnDocumentReady(() =>
{%>
<%= Html.ClientSideValidation("contactform", typeof(ContactForm)) %>
<%});
%>
(or, of course, use Response.Write)
The ClientSideValidation helper returns string.
Kind regards,
Alex
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
It should be like this:
<% Html.Telerik().ScriptRegistrar()
.OnDocumentReady(() =>
{%>
<%= Html.ClientSideValidation("contactform", typeof(ContactForm)) %>
<%});
%>
(or, of course, use Response.Write)
The ClientSideValidation helper returns string.
Kind regards,
Alex
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
GrZeCh
Top achievements
Rank 2
answered on 19 Nov 2009, 03:57 PM
This is solution to my problem:
I didn't have to move anything from page bottom.
| <% Html.Telerik().ScriptRegistrar() |
| .OnDocumentReady(() => |
| {%> |
| <%= Html.ClientSideValidation("contactform", typeof(ContactForm)).SuppressScriptTags().ToString() %> |
| <%}); |
| %> |
I didn't have to move anything from page bottom.