I have 10 textboxes eg:
textbox1
textbox2
textbox3
textbox4
textbox5
textbox6
textbox7
textbox8
textbox9
textbox10

How can I get the name of TextBox eg textbox3 when user clicks (Mouse) on it. The textboxes are on a asp.net web page. Its written in VB.Net.

Recommended Answers

All 2 Replies

Please post in the ASP.Net forum

Adrian - you cannot have events fire when the user clicks a control (such as a textbox) using vb.net. You would need to use javascript's OnClick event.

document.getElementById(textboxX).onfocus
{
Do stuff in here!
}

The reason for this is because vb.net only "fires" when the webpage communicates directly with the server. Javascript enables client side events - events that occur without the page needing to talk with the server.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.