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

Why RadDatePicker1.DateInput.Text=""

1 Answer 113 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Higher
Top achievements
Rank 1
Higher asked on 28 Feb 2009, 12:37 PM
example:
RadDatePicker1.SelectedDate = System.DateTime.Now();
RadDatePicker1.DateInput.DateFormat = "yyyyMMdd";
string sDate=RadDatePicker1.DateInput.Text;

why sDate=""?
I think sDate="20090228".

sorry,my english is poor.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Mar 2009, 06:57 AM
Hello Higher,

The DateFormat property specifies the format of the control's value when it has focus (when the user can edit the value). I guess, the DateFormat when retrieving the text of the DateInput, it will be in default format. I tried following code snippet in order to get the DateInput text in required format.

CS:
protected void Page_Load(object sender, EventArgs e)  
{  
    RadDatePicker1.SelectedDate = System.DateTime.Now;  
    RadDatePicker1.DateInput.DateFormat = "yyyyMMdd";  
}  
protected void Button1_Click(object sender, EventArgs e)  
{  
    DateTime selDate = (DateTime) RadDatePicker1.DateInput.SelectedDate;  
    string sDate= selDate.ToString("yyyyMMdd");  

Thanks,
Princy.
Tags
Calendar
Asked by
Higher
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or