InsertItemTemplate for RadDatePicker

5 posts, 0 answers
  1. Neill Davies
    Neill Davies avatar
    3 posts
    Member since:
    Oct 2009

    Posted 17 Dec 2009 Link to this post

    Hi,

    I have a VB.NET project with a FormView which has an EditItemTemplate and InsertItemTemplate.
    Both templates contain a RadDatePicker with the same ID and properties assigned, because I want to reference both with the same code, depending on which FormViewMode is assigned. Unfortunately my code appears to pick up only the EditItemTemplate version of the RadDatePicker, regardless of the current FormViewMode. When the form is running in Insert mode, all standard .NET controls are bound successfully, but the RadDatePicker is not. I've tried calling the two RadDatePicker controls by different ID names, but the problem appears to be with Insert mode. Another forum post suggested changing the DefaultMode of the FormView, but this doesn't make any difference in my case. Any ideas would be greatly appreciated.

    Cheers,
    Neill Davies - Nightfreight I.T.


    VB.NET (shortened):


     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

     

     


    If
    Session("ApplicationStatus").ToString.Trim = "NEW" Then

     

     

     

     

    CDCustomerDetails.ChangeMode(FormViewMode.Insert)

     

    Else

     

     

     

    CDCustomerDetails.ChangeMode(FormViewMode.Edit)

     

     

    End If

     

     

     


    Dim ProposedStartDateCtrl As RadDatePicker = CType(CDCustomerDetails.FindControl("RadProposedStartDate"), RadDatePicker)

     

    ProposedStartDateCtrl.MinDate = DateTime.Now.Day &

    "/" & DateTime.Now.Month & "/" & DateTime.Now.Year

     

    ProposedStartDateCtrl.FocusedDate = ProposedStartDateCtrl.MinDate

     

     

    End

     

    Sub

     

     

     

     

    The minimum date setting & focussed date only work when the form is running in Edit mode.


    HTML (shortened):

     

     

    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="4" BorderColor="Black" BorderStyle="Solid">

     

     

     

    <telerik:RadPageView ID="RadPageView1" runat="server" Selected="True">

     

     

     

    &nbsp;<asp:FormView ID="CDCustomerDetails" runat="server" DefaultMode="Insert" BorderColor="White" CssClass="form"

     

     

     

    DataSourceID="datCustomerDetails">

     

     

     

    <EditItemTemplate>

     

     

     

    <table>

     

     

     

    <tr>

     

     

     

    <td>
    <telerik:RadDatePicker ID="RadProposedStartDate" runat="server" Culture="English (United Kingdom)"

     

     

     

    DbSelectedDate='<%# Bind("ProposedStartDate") %>'>

     

     

     

    <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">

     

     

     

    </Calendar>

     

     

     

    <DatePopupButton HoverImageUrl="" ImageUrl="" />

     

     

     

    </telerik:RadDatePicker>

     

     

     

    <br />

     

     

     

    <asp:RangeValidator ID="valProposedStartDate" runat="server" ControlToValidate="RadProposedStartDate"

     

     

     

    Display="Dynamic" ErrorMessage="Only future dates accepted, format DD/MM/YYYY"

     

     

     

    Font-Bold="True" MaximumValue="31/12/2099" MinimumValue="01/12/2009" Type="Date"

     

     

     

    Width="216px"></asp:RangeValidator></td>

     

     

     

    </tr>
    </table>

     

     

     

    </EditItemTemplate>

     

     

     

    <InsertItemTemplate>
    <table>

     

     

     

    <tr>

     

     

     

    <td>
    <telerik:RadDatePicker ID="RadProposedStartDate" runat="server" Culture="English (United Kingdom)" DbSelectedDate='<%# Bind("ProposedStartDate") %>'>

     

     

     

    <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">

     

     

     

    </Calendar>

     

     

     

    <DatePopupButton HoverImageUrl="" ImageUrl="" />

     

     

     

    </telerik:RadDatePicker>

     

     

     

    <br />

     

     

     

    <asp:RangeValidator ID="valProposedStartDate" runat="server" ControlToValidate="RadProposedStartDate"

     

     

     

    Display="Dynamic" ErrorMessage="Only future dates accepted, format DD/MM/YYYY"

     

     

     

    Font-Bold="True" MaximumValue="31/12/2099" MinimumValue="01/12/2009" Type="Date"

     

     

     

    Width="216px"></asp:RangeValidator></td>

     

     

     

    </tr>
    </table>

     

     

     

    </InsertItemTemplate>

     

  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 19 Dec 2009 Link to this post

    Hello Neill,

    I followed your scenario in order to replicate the issue but to no avail. Could you please check the attached project and let me know what differs in your case?

    Regards,
    Iana
    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. Jared Lewis
    Jared Lewis avatar
    9 posts
    Member since:
    Feb 2010

    Posted 25 Mar 2010 Link to this post

    Somewhat of the same problem here Neill. I have a RadScheduler and also a RadWindow (treating it as a popup div) to handle my Appointment edits and I get: Error: Sys.InvalidOperationException: Two components with the same id 'ctl00_mainContent_RadWinAppointment_C_radApptDatePicker_dateInput' can't be added to the application. I only have one... so where is this other one? I can only guess that it is within the scheduler. Oh what fun it is...

    Good luck!

    Jared.
  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 26 Mar 2010 Link to this post

    Hi Jared,

    The mentioned error usually appears when you have nested UpdatePanels or due to improper ajax-enabling.
    Can you share the problematic page code here, or send us a sample project for further investigation?

    Greetings,
    Iana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Jared Lewis
    Jared Lewis avatar
    9 posts
    Member since:
    Feb 2010

    Posted 26 Mar 2010 Link to this post

    Iana,
    You are correct, it was improper ajax-enabling. The radWindow was being completely loaded twice therefore multiple controls of the same name in the page. So, note to all the others... ajax the ContentContainer, not the RadWindow.

    Thanks for your prompt reply.

    Jared
Back to Top