更改asp文本框的文本时触发事件(Trigger event when asp textbox's text is changed)
我有一个asp:TextBox绑定到日历。 我想通过日历更改日期时更新gridview。 如果不提交表格我该怎么办?
I have a asp:TextBox which is binded to calender. I want to update gridview when date is changed via calender. How can i do it without submitting the form?
最满意答案
您可以处理日历的SelectionChanged事件,然后调用文本框的textChanged事件,该事件将更新gridview,如下所示:
protected void MyCalendar_SelectionChanged(object obj, EventArgs e) { MyTextbox.Text = MyCalendar.SelectedDate.ToShortDateString(); TextBox_TextChanged(null, EventArgs.Empty); }You could handle the calendar's SelectionChanged event, and from there call the textbox's textChanged event which would in turn update the gridview, like so:
protected void MyCalendar_SelectionChanged(object obj, EventArgs e) { MyTextbox.Text = MyCalendar.SelectedDate.ToShortDateString(); TextBox_TextChanged(null, EventArgs.Empty); }更多推荐
发布评论