RadDatePicker control with Ajax.BeginForm(...)

Thread is closed for posting
3 posts, 0 answers
  1. Baskin
    Baskin avatar
    2 posts
    Member since:
    Jun 2009

    Posted 20 Oct 2009 Link to this post

    We are having issues with the RadDatePicker control inside the Ajax.BeginForm construct.  Although the control renders properly, it does not have button click events and calendar view does not display.
    --------------------------
    inside index.aspx:

    <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

    <%@ Import Namespace="MvcApplication5.Controllers" %>
    <asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
        Home Page
    </asp:Content>
    <asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
        <h2>
            <%= Html.Encode(ViewData["Message"]) %></h2>
        <p>
            To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">
                http://asp.net/mvc</a>.
        </p>
        <% using (Ajax.BeginForm("Partial", new AjaxOptions() { UpdateTargetId = "contentWrapper" }))
           { %>
        <div id="contentWrapper">
            <%Html.RenderPartial("RadDatePickerView");%>
        </div>
        <input type="submit" />
        <%} %>
    </asp:Content>


    ------------------------------------
    inside RadDatePickerView.ascx:

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
    <%@ Import Namespace="Telerik.Web.Mvc" %>
    <%= Html.RenderRadDatePicker(control =>
                                           {
                                               control.Calendar.Width = Unit.Pixel(250);
                                               control.DbSelectedDate = DateTime.Now;
                                           },"Hay")%>



    How to use:

     

    1)      Open home page(default)

    2)      Make sure DatePicker works correctly

    3)      Press ‘Submit Query’ button. This will submit the form

    4)      DatePicker doesn’t work




    Please let us know if there is a simple work-around for this control to render properly using Ajax forms in MVC framework.

    Thanks in advance.

    Baskin


  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 23 Oct 2009 Link to this post

    Hello Baskin,

    The depicted issue is related to the inability of the AJAX ASP.NET MVC to evaluate the JavaScript. You should evaluate the loaded scripts with eval(...) method to avoid the described problem.

    Best wishes,
    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
  4. Aiyaz
    Aiyaz avatar
    13 posts
    Member since:
    Apr 2007

    Posted 18 Dec 2009 Link to this post

    Hi,
    Im trying to use telerik controls 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 get the use telerik controls inside the BeginForm method without using the scriptmanager?

    <%@ 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" />
    <% } %>
Back to Top