How can I set some text to a label but also store its ID. For instance I’m taking an ID/text value pair and painting the text in a label but I need to store the ID somewhere to be able to retrieve both that text value and ID later on for some more logic in the page.
I don’t think you can store an ID in a label…which is what I’m using. I can append html() to the label using jquery’s html() function but then I do not know if this is a good html control to be using as I can’t store the ID anywhere.
It is probably obvious what my choices are but honestly I’ve never come across this issue before. I thought I could use an asp.net literal but I don’t think that’s gonna help me either with storing the ID.
if you are using jQuery,you can use
jQuery.data();for this. And if you are using HTML5 , you can use client side storage.