Telerik
Skip Navigation LinksHome / Community / Forums / ASP.NET > General Discussions > RadDateTimePicker in Radgrid

Answered RadDateTimePicker in Radgrid

Feed from this thread
  • Chinmay avatar

    Posted on Jun 14, 2009 (permalink)

    Hi I am Chinmay , i am using telerik Rad controls in  my projects.
    Problem : -
    I have two  fields in telerik radgrid.  one is a readonly textbox with datetime value . other is a RadDateTimePicker.

    Requirement - Whenever I change/select a date from RadDateTimePicker it should check whether  the selecteddatetime is greater than the value present in the readonly textbox  and popup a window with a simple message . All this we have to achieve through javascript and the validation should takes place as soon as we select a new value from RadDateTimePicker

    I tried with SelectedDateChanged  event of RadDateTimePicker but I am unable to access the javascript method attached to this event.

    Can you please help me and if possible can you please post a sample code  to achieve the requirement.

    Thanks in advance.




    Reply

  • Telerik Admin admin's avatar

    Posted on Jun 14, 2009 (permalink)

    Hello Chinmay,

    Please test the following code-snippet and let me know whether it is suitable for your scenario:
    <script type="text/javascript"
        function dateSelected(sender, args) 
        { 
            var tboxDate = new Date($get("TextBox1").value); 
            var dtpDate = args.get_newDate(); 
            if (dtpDate > tboxDate) 
                alert("DatePicker date [" + dtpDate + "] > TextBox date [" + tboxDate + "]"); 
        } 
    </script> 

    <telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server" Culture="en-US"
        <ClientEvents OnDateSelected="dateSelected" /> 
    </telerik:RadDateTimePicker> 
    <asp:TextBox ID="TextBox1" runat="server" ReadOnly="true" Text="1/20/2009" /> 

    Kind regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

  • Chinmay avatar

    Posted on Jun 15, 2009 (permalink)

    Thanks Daniel for the reply,
    I think your approach is right.
    Actually it's not readonly textbox it's a label .and i am not able to access the label value.
    But for time being let it be a textbox ( present in RadGrid  as I have mentioned in the first post )
    It's giving a javascript error on this line - var tboxDate = new Date($get("TextBox1").value);

    and I also tried with var tboxDate = new Date($get("<% = TextBox1.ClientId % >").value);
    Still it's not working. I think as the textbox is in the RadGrid so there might be some other way to access it.
    One more think
    the requirement is not to select the row also.

    Today I tried some alternatives but still no results . I am finding it hard to use Rad Controls.

    My requirement in simple terms , if that can help you understanding the requirement -
    1 ) No row selection
    2 ) On change of date it should get the textbox value (which contains a datetime value) which is present in the same row as the raddatetimepicker  and should compare with the datetimepicker value and alert a message .

    Let me know if you need more information .

    Thanks in advance..



    Reply

  • Answer Telerik Admin admin's avatar

    Posted on Jun 18, 2009 (permalink)

    Hello Chinmay,

    Thank you for the clarification. Please find attached a simple demo which I created for you.

    Hope this helps.

    Regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community / Forums / ASP.NET > General Discussions > RadDateTimePicker in Radgrid

Powered by Sitefinity ASP.NET CMS

Contact Us | Site Feedback | Terms of Use | Privacy Policy
Copyright © 2002-2010 Telerik. All rights reserved.