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

DatePicker

3 Answers 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jakub Wilk
Top achievements
Rank 2
Jakub Wilk asked on 12 Oct 2009, 12:54 PM

Hi,
I have on page RadDatePicker

<tel:RadDatePicker ID="dpStartDate" runat="server" DateInput-ID="diStartDate">  
<Calendar ID="c1" runat="server" FocusedDate="2006-10-30" />                      
<DateInput CatalogIconImageUrl="" Description="" DisplayPromptChar="_" PromptChar=" " 
Title="" TitleIconImageUrl="" TitleUrl=""  />                      
</tel:RadDatePicker> 

I'm trying to set a date in this RadDatePickter using WebAii Free testing framework.
When I get an instance of this picker there is no method or property to set a date. All of the are only "get" properties.
How I can achieve this functionality?
Seba

3 Answers, 1 is accepted

Sort by
0
Accepted
Pavel
Telerik team
answered on 13 Oct 2009, 08:44 AM
Hello Seba,

You can access the DateInput part of the picker and type the value in it or simply set the date via the InputValue property. Here is a code snippet for illustration:

RadDateInput input = Find.ById<RadDateInput>("dpStartDate_dateInput_wrapper");
//input.InputValue = DateTime.Today.AddDays(3).ToShortDateString();
 
input.TypeText(DateTime.Today.AddDays(3).ToShortDateString());


Kind regards,
Pavel
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
Jakub Wilk
Top achievements
Rank 2
answered on 13 Oct 2009, 10:01 AM
Thanks!

Its working
0
Pavel
Telerik team
answered on 16 Oct 2009, 01:42 PM
Hello Seba,

Just a quick note on an improvement we've made and which will be available in the 2.0 version of the Testing Framework. We have added a property which exposes the DateInput part of the Picker's wrapper. Here is a sample test:

[TestMethod]
public void SetDate()
{
    Manager.LaunchNewBrowser();
 
    RadDatePicker picker = Find.ById<RadDatePicker>("RadDatePicker1_wrapper");
    ((RadDateInput)picker.DateInput).InputValue = DateTime.Today.AddDays(3).ToShortDateString();
    Assert.AreEqual(DateTime.Today.AddDays(3), picker.SelectedDate);
}


Regards,
Pavel
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.
Tags
General Discussions
Asked by
Jakub Wilk
Top achievements
Rank 2
Answers by
Pavel
Telerik team
Jakub Wilk
Top achievements
Rank 2
Share this question
or