Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding tooltip for RadioButtonList items

My RadioButtonList is bound to the database as follows:

SqlDataAdapter adapter = new SqlDataAdapter("SELECT ItemsID,ItemsDescription FROM Items", con);
adapter.Fill(subjects);
rblUseCases.DataSource = subjects;
rblUseCases.DataTextField = "ItemsDescription";
rblUseCases.DataValueField = "ItemsID";          
rblUseCases.DataBind(); 

I need to add a new tooltip to be shown when the user hovers around any radio button. I plan to add the tooltip text as a new column Tooltip in the database table Items. How can I databind this to the radio button?

like image 322
Nemo Avatar asked May 15 '26 20:05

Nemo


1 Answers

The following code will show tooltip on the radio button:

ListItem li=new ListItem("Manish","oopde");
li.Attributes.Add("title","zello");
RadioButtonList1.Items.Add(li);

For databinding you can iterate through each item and add the attributes to it. The databound and databinding event doesn't call for each items because of which we didn't get any other option to implement the same.

like image 68
mannu2050 Avatar answered May 17 '26 08:05

mannu2050



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!