Display tooltip from database for dropdownlist items in asp.net c# example
Example of Display tooltip from database for dropdownlist items in asp.net c#
In this post we describe a Example for display tooltip in dropdownlist each item in asp.net. And the importance of Tooltip
is in web development we can use long length world in dropdown list in name
field. In this asp.net Programming tutorial we consider a post how to show tool tip of dropdownlist item on mouseover event and many Examples that’s refers to
dropdown list, these are listed here each have relation to dropdownlist example:
Asp.net Dropdownlist Related Post:
- Bind Dropdown by Dynamically
- Fill Dropdown By database.
- Adding or binding tooltip in each item of dropdownlist
- Check box in asp Dropdown List.
- DropDown List in asp.net Programming,
- Add ListItem in DropDownList asp.net c# Example
- Drop Down List control of asp.net
- Select option to the user from many items.
- Display tooltip from database for dropdownlist items in asp.net c# example
- Show tooltip dropdownlist items by mouseoverevent using C# example
- Example of Adding ToolTip for each Dropdown List Item in C#
- Limit Number of Characters in a TextArea using jQuery
- Limitation of Characters in Textbox or TextArea in asp.netusing jquery:
Display ToolTip for Dropdown List:
Example of use tooltip in dropdownlist in c#:
Take a sql database table and bind dropdownlist. Then create
dropdownlist DataBound Method and using this bind name to tooltip. Here we
give the code for solving this in asp.net using C#.
Show Tooltip Example of dropdownlist item code :
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DropDownlistItemtooltip.aspx.cs" Inherits="DropDownlistItemtooltip" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="PageHead1" runat="server">
<style type="text/css">
.P
{
font-size:14.0pt;
font-family:"Calibri","sans-serif";
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div align="center">
<br />
<h2> Display tooltip from
database for dropdownlist items Example</h2>
<p><strong>Select State for this
dropdownlist </strong></p>
<br />
<br />
<asp:DropDownList ID="myddlist" runat="server" ondatabound="myddlist_DataBound" onselectedindexchanged="myddlist_SelectedIndexChanged"/>
</div>
</form>
</body>
</html>
Use Tooltip on dropdownlist each item C# code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class DropDownlistItemtooltip : System.Web.UI.Page
{
string _connectionstring;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
_connectionstring = @"Data
Source=PARIJAT-PC\PARIJAT;Initial Catalog=Database1;Integrated
Security=True;Pooling=False";
BindData();
}
}
protected void BindData()
{
string _sql = "select
StateID,StateName from States";
SqlConnection _connection = new SqlConnection(_connectionstring);
SqlCommand _command = new SqlCommand(_sql, _connection);
SqlDataAdapter _adapter = new SqlDataAdapter(_command);
DataTable datatable = new DataTable();
_adapter.Fill(datatable);
myddlist.DataTextField = "StateName";
myddlist.DataValueField = "StateID";
myddlist.DataSource = datatable;
myddlist.DataBind();
}
protected void myddlist_DataBound(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
if (ddl != null)
{
foreach (ListItem li in ddl.Items)
{
li.Attributes["title"] = li.Text;
}
}
}
protected void myddlist_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
Other Asp.net Related
Post :
- Cropping image using jQuery in asp.net
- Use of view state.
- events in asp.net
- Post back And call back
- control execution life cycle.
- asp.net-user-control-basics.
- image size before Uploading.
- server control.
- Textbox Asp.net control
- Introduction of SQL
- Asp.net Imagebutton control example
- Literal control in Asp.net
- ImageButton control
- Asp.net Button control.
- Bind Data to asp.net textbox control in inside of gridview
Using C# Example
- Example of C# for Bind Data to asp.net Textbox inside gridview
control
csharp programming to learning
ReplyDeleteDisplay a notification icon in the system tray