Reputation: 55
I have a string value which is in DateTime format where I have captured from a different Calendar control; How can I display that value in a Calendar control in a asp.net form?
string dateTo = dsDept.SelectedRow.Cells[3].Text;
string datefrom = dsDept.SelectedRow.Cells[2].Text;
Two string values are selected from a data grid view. I need these two dates to be displayed in two Calendar controls.
Upvotes: 0
Views: 754
Reputation: 77934
You need to convert that to DateTime
and then assign to calendar SelectedDate
property like
DateTime capturedDate;
if(DateTime.TryParse(dateTo, out capturedDate))
{
Calendar1.SelectedDate = capturedDate;
}
Upvotes: 1