更改asp文本框的文本时触发事件(Trigger event when asp textbox's text is changed)

编程入门 行业动态 更新时间:2024-10-27 21:16:22
更改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); }

更多推荐

本文发布于:2023-08-04 01:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1405841.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文本框   文本   事件   asp   Trigger

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!