Click here to Skip to main content
13,091,894 members (59,206 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have 12 labels
in a aspx page
how can i get the Text of
any label when is clicked.
I have Tried using the Click event of every label
But the coding is getting more.
Is there any Other option or idea
to fetch the text .
Please Assist any Idea.
Am using following Code to get the text on every click event of labels.
Dim str as String 
str =label1.text.tostring

but this way I have to create events on every 12 labels.
But i think there must be some another way to handle this
may be writing some functions.
Please assist.
Posted 8-Feb-13 19:11pm
Updated 11-Feb-13 1:34am
Do you know JavaScript? What did you try?
I would advice jQuery, then it's really easy.
Nandakishorerao 9-Feb-13 6:52am
on what click are you expecting..on label or button click?..can you be little more specific
Karwa_Vivek 9-Feb-13 7:02am
On click event of Label .I want to fetch the text of that Particular label which is clicked.
Gunjan Bhasin 10-Feb-13 2:40am
you want it to be done on label's click event and you mentioned 'you have tried using click event of button?' hard to understand. please be specific. Paste code if possible.
Muthuraja Irullandi 10-Feb-13 5:55am
You can also consider the LinkButton instead of label.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


try using jQuery.

A label generates a div, so this should work:

  //some code

Hope it helps.
Karwa_Vivek 11-Feb-13 7:37am
I didnt undestand what you trying to say.
How should i use this
_Zorro_ 11-Feb-13 7:51am
Well, you'll have to do a bit of research, take a look at jQuery and you'll understand.
Otherwise take a look at this:

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 11 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100