如何在文本框中显示选定的日历值?我想在asp.net或C#中得到答案. 对于WinForms(我使用过DateTimePicker),您可以处理ValueChanged事件…… private void dateTimePicker1_ValueChanged(object sender, EventArgs e){
private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { textBox1.Text = dateTimePicker1.Text; }
对于ASP.NET控件(我使用了Calendar控件),您可以处理SelectionChanged事件…
[Markup] <asp:Calendar ID="Calendar1" runat="server" onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> [CodeBehind] protected void Calendar1_SelectionChanged(object sender, EventArgs e) { TextBox1.Text = Calendar1.SelectedDate.ToShortDateString(); }
希望能帮助到你 :)