how to get client id for labels and literals

Posted by Oswaldlily under ASP.NET on 9/30/2011 | Points: 10 | Views : 3153 | Status : [Member] | Replies : 6
How to get client id for "label"
var a = document.getElementById('<%=label1.ClientID %> ');

if for label not possible,tell how to get client id for literals
var a = document.getElementById('<%=literals1.ClientID %> ');

I tried for both like this..But not getting msg box




Responses

Posted by: Blessyjees on: 9/30/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Which version of .net you are using? If you are using .net 4.0, no need to use this, we can directly get the control id in js. In other versions we are using this to get clientid.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 9/30/2011 [Member] Starter | Points: 25

Up
0
Down
I m using .net 4 oly...How to directly get client id here???

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gausi on: 9/30/2011 [Member] Starter | Points: 25

Up
0
Down
in .net 4.0 we have "ClientIDMode" to know detail about this follow the link give below..

http://weblogs.asp.net/asptest/archive/2009/01/06/asp-net-4-0-clientid-overview.aspx

http://blog.osbornm.com/archive/2009/01/06/asp.net-4.0-clientid-overview-again.aspx



Regards,

Gaurav Singh
(gausi)

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 9/30/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Set the property "ClientIDMode" of the Label control to "static". If you se this you can call
var a = document.getElementById('label1'); 



Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 9/30/2011 [Member] Starter | Points: 25

Up
0
Down
@Blessyjees
can u giv ur mail id

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 9/30/2011 [Member] Bronze | Points: 25

Up
0
Down
hi.
Can you get the control in javascript?

my mail id= blessybaby@gmail.com

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response