我有一个从不同Calendar控件捕获的DateTime格式的字符串值;如何在asp.net表单中的Calendar控件中显示该值?
string dateTo = dsDept.SelectedRow.Cells[3].Text;
string datefrom = dsDept.SelectedRow.Cells[2].Text;
从数据网格视图中选择两个字符串值。我需要在两个Calendar控件中显示这两个日期。
发布于 2016-08-04 20:07:16
您需要将其转换为DateTime
,然后将其分配给日历SelectedDate
属性,如
DateTime capturedDate;
if(DateTime.TryParse(dateTo, out capturedDate))
{
Calendar1.SelectedDate = capturedDate;
}
https://stackoverflow.com/questions/38776342
复制