Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Obtaining element ID for client script

Reply
Thread Tools

Obtaining element ID for client script

 
 
kw
Guest
Posts: n/a
 
      08-23-2004
What is the proper way to get the element ID for a client script?

For example, suppose in the WebControl:
TextBox t=new TextBox;
t.ID=this.ClientID+"X";
....
Then elsewhere we want to access it on the client:
Control.Attributes["OnClick"] =
"javascript:document.getElementById('"+this.Client ID+"X"+"').value=
'test';";

It doesn't work because the textbox ID becomes something like:

TextBox1_X

and the link control looks like this:

javascript:document.getElementById('TextBox1X').va lue= 'test';


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
knowing where a block element is within the client element? Javascript 1 10-09-2007 09:20 PM
Obtaining hte currently running script under windows Sean Farrow Python 1 06-08-2007 05:55 PM
Obtaining an int element from an arraylist? nooneinparticular314159@yahoo.com Java 10 05-15-2005 05:53 AM
Obtaining the position of an element with a collection =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?= C++ 2 10-24-2004 08:20 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57