This is a migrated thread and some comments may be shown as answers.

RadDatePicker control with Ajax.BeginForm(...)

2 Answers 98 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Baskin
Top achievements
Rank 1
Baskin asked on 20 Oct 2009, 07:42 PM
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")%>



2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 23 Oct 2009, 08:03 AM
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.
0
Aiyaz
Top achievements
Rank 1
answered on 18 Dec 2009, 10:37 AM
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" />
<% } %>
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Baskin
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Aiyaz
Top achievements
Rank 1
Share this question
or