Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 8-Feb-14 0:31am
v3
Comments
abhijitmalkar 8-Feb-14 6:45am    
do u mean ?
how to check which textbox value is changed out of 50 textboxes?

-------------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>
 
Share this answer
 
Comments
astika 10-Feb-14 6:22am    
no i dont want like that.bcoz for each textbox it is not good to check event each time.
I wants to know any method of web page so that i can understand text box is changed
abhijitmalkar 11-Feb-14 2:37am    
what do u want vb or c# code?
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

--------------------------------------------------
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900