Telerik Ajax controls with ASP.Net MVC 2 RC server/client validation

Thread is closed for posting
2 posts, 0 answers
  1. Aiyaz
    Aiyaz avatar
    13 posts
    Member since:
    Apr 2007

    Posted 19 Dec 2009 Link to this post

    Hi,
    Im trying to use telerik controls with ASP.Net MVC 2 RC.  Im trying to use the MVC dataannotations server/client validations on the form which has some telerik controls placed inside.  My problem is that MVC client validation stops working when I try to use the RADScriptManager with a html form tag. It seems like the MVC EnableClientValidation only works with use Html.BeginForm method because it wires up some flags in the background when its rendering the form tag.

    When I place the RADScriptManager inside the Html.BeginForm and I get the RADScriptManager requires a form runat="server" error.
    If i add a html form tag e.g <form id="frm" runat="server"> on the page and add scriptmanager then the Html.EnableClientValidation is not triggered.  Is there a way to make this work?
    <%@ Page Language="C#" Inherits="ViewPage<ProductViewModel>" %>

    <% Html.EnableClientValidation(); %>
    <% using (Html.BeginForm()) { %>

      <%= Html.TextBoxFor(m => m.Title) %>
        <%= Html.ValidationMessageFor(m => m.Title) %>
      <%= Html.TextBoxFor(m => m.Price) %>
        <%= Html.ValidationMessageFor(m => m.Price) %>

        <input type="submit" />
    <% } %>
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 23 Dec 2009 Link to this post

    Hello Aiyaz,

    I tried to reproduce the depicted issue, but no avail. Please examine it and let me know if I am missing something.

    In general MVC client validation is not suppose to validate ASP.NET AJAX controls on the page.

    Sincerely yours,
    Georgi Krustev
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top