如何检查文本框中的值是否已选中 [英] how to check value from textbox is checked
本文介绍了如何检查文本框中的值是否已选中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello Everyone
a有一个网页有50个文本框。如果有任何数据被更改,我必须保存它。
如何检查任何一个文本框中的值都被更改。
谢谢。
plz help
Hello Everyone
a have one web page which have 50 textbox.If any ones data is changed than i have to save it.
how to check Value in any one textbox is changed.
Thanks.
plz help
推荐答案
-------------in .cs page
protected void TextBoxName_TextChanged(object sender,EventArgs e)
{
do insertion
}
--------------in .aspx page
<asp:textbox id="TextBoxName" runat="server" ontextchanged="TextBoxName_TextChanged" xmlns:asp="#unknown"></asp:textbox>
Dim numOfDesiredControls As Int16
受保护的子Page_Load()处理form1.Load
试试
numOfDesiredControls = Convert.ToInt16(txtEnter.Text)
如果不是numOfDesiredControls = 0那么
对于i as Int16 = 1 To numOfDesiredControls
Dim txtTest As New TextBox
txtTest.Text =dynamicTextBox
txtTest.ID =dynamicTextBox+ i.ToString
txtTest.AutoPostBack = True
'txtTest.EnableViewState = False
Form.Controls.Add(txtTest)
AddHandler txtTest.TextChanged,AddressOf dynamicEventHandler
下一页
结束如果
Catch ex As Exception
结束尝试
结束子
受保护的子DynamicEventHandler(ByVal发送者为对象,ByVal e As System.EventArgs)
'如果事件处理程序被触发,请通过更改lblConfirm的文本来反映这一点
Dim txt As TextBox
txt = CType(sender,TextBox)
lblConfirm.Visible = True
lblConfirm.Text =事件处理程序+ txt.Id +炒:+ txt.Text
结束子
------------------------------------------- -------
Dim numOfDesiredControls As Int16
Protected Sub Page_Load() Handles form1.Load
Try
numOfDesiredControls = Convert.ToInt16(txtEnter.Text)
If Not numOfDesiredControls = 0 Then
For i As Int16 = 1 To numOfDesiredControls
Dim txtTest As New TextBox
txtTest.Text = "dynamicTextBox"
txtTest.ID = "dynamicTextBox" + i.ToString
txtTest.AutoPostBack = True
' txtTest.EnableViewState = False
Form.Controls.Add(txtTest)
AddHandler txtTest.TextChanged, AddressOf dynamicEventHandler
Next
End If
Catch ex As Exception
End Try
End Sub
Protected Sub dynamicEventHandler(ByVal sender As Object, ByVal e As System.EventArgs)
' If the event handler gets fired, reflect this by changing the text of lblConfirm
Dim txt As TextBox
txt = CType(sender, TextBox)
lblConfirm.Visible = True
lblConfirm.Text = "Event handler " + txt.Id + " fired: " + txt.Text
End Sub
--------------------------------------------------
这篇关于如何检查文本框中的值是否已选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文