How to set RadioButtonList listitem tooltip with C# example

Category > ASP.NET || Published on : Sunday, September 7, 2014 || Views: 15903 || RadioButtonList listitem tooltip


In this tutorial, We are going to learn How to set RadioButtonList listitem tooltip with C# example

RadioButtonList is an asp.net list web server control. we can set a tool tip for radiobuttonlist control by setting a value to its built in property named ToolTip. but radiobuttonlist server control have no built in property to display different tool tip for each item.

ListItem.Attributes property get a collection of attribute name and value pair for the ListItem that are not directly supported by the class. we can add any css style name and value pair to this attribute collection by calling ListItem.Attribute.Add() method. Add() method have two arguments, first argument is a css style name and second argument is the specific style's value.

so that to display different tool tip on radiobuttonlist each item, we add an attribute to each list item. here we added a css title style with value to each list item object. as a result in a web browser radiobuttonlist control display different tool tip for each item.

Step 1: Create a ASP.NET empty Web Application

Step 2: Create a webform “Default.aspx” and write the following codes.

<%@ Page Language="C#" AutoEventWireup="true"%>    
      
        
        
        
"http://www.w3.org/1999/xhtml">        
"Head1" runat="server">        
    How to <span style="color:Blue">set</span> RadioButtonList listitem tooltip with C# example
        
        
    "form1" runat="server">        
    

"color:orange; font-style:italic;"> How to set RadioButtonList listitem tooltip with C# example


"550" align="left" color="Gainsboro" /> "Label1" runat="server" Font-Size="Large" Width="350" Text="select an item from radiobuttonlist" >

"RadioButtonList1" runat="server" RepeatDirection="Vertical" AutoPostBack="true" RepeatLayout="Flow" >

 

Step 3:  Run the application or press the F5 Key on the keyboard. You will get the following output as below to set RadioButtonList listitem tooltip with C# example

Conclusion:-
so In this tutorial, we have learned How to set RadioButtonList listitem tooltip with C# example. Happy Coding!!!!

 

Download Source Codes