I have a situation which come in front of me very often but I don't have any solution to it right now. Suppose I have a key/value pair like this
UserID | UserName ----------------- 1 | Yogi 2 | Mike
I want to bind this data to an asp label control, Right now what I do is, I bind UserID to the tooltip of the label & UserName to the text of the label, It works fine but drawback is that when user hovers the label it shows UserID as a tooltip to the user which is obvious. I want to find some better way to do this job, please help me to get a better approach here.
For ASP.Net
Create a custom attribute like
mylabel.Attributes["attributename"] = value;
For WinForms/WPF
Give it in its Tag
property. I use that property for these kind of purposes.
Provide Username in Label and when it is label is hovered over, extract the tag (array or list) and display in tooltip.
mylabel.Tag = value;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With