Solved

Adding OnTextChange to Programatically added Textboxes?

Posted on 2008-10-20
2
390 Views
Last Modified: 2012-05-05
How can I add an OnTextChange event to a textbox I am adding programatically?
0
Comment
Question by:higginsonline
2 Comments
 
LVL 13

Accepted Solution

by:
crazyman earned 500 total points
ID: 22758345
AddHandler txtError.TextChanged, AddressOf txtError_TextChanged

...

Protected Sub txtError_TextChanged(ByVal sender As Object, ByVal e As EventArgs)
End Sub
0
 
LVL 6

Expert Comment

by:AmarIs26
ID: 22759048
You need to recreate each textbox everytime the page is created (even during postbacks). In addition to this you need to assign an id to each textbox, this id must remain constant. so if you are creating textboxes inside the a loop then something like the following will do
textbox(i).ID = "textBox" + i.ToString()
The reason for setting an id is that, after the control is created during postbacks, it will map onto the correct event handler for that instance based on the ID.
Finally, Do what CrazyMan suggested.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now