Hi everyone,
i have a table.It has a fields like Id,Name,Description.I need to bind the data to gridview.for description column i need to show 150 charters in gridview, when ever user mouse over on thatdescrption column entire data should be displayed in tool tip.
can any one tell me please.here is my code.
thanking you,
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server"
onrowdatabound="GridView1_RowDataBound">
</asp:GridView>
</div>
</form>
</body>
</html>
aspx.cs:
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Description", typeof(string));
DataRow dr = dt.NewRow();
dr[0] = 1001;
dr[1] = "sukumar";
dr[2] = "Hiiiiiiiiiii This is the sampleeeeeeee Testttttttttttt malilll";
dt.Rows.Add(dr);
DataRow dr2 = dt.NewRow();
dr2[0] = 1002;
dr2[1] = "amala";
dr2[2] = "Hiiiiiiiiiii This is the sampleeeeeeee Testttttttttttt malilll";
dt.Rows.Add(dr2);
DataRow dr1 = dt.NewRow();
dr1[0] = 1003;
dr1[1] = "akash";
dr1[2] = "Sampleeeeeeee This is the sampleeeeeeee Testttttttttttt malilll";
dt.Rows.Add(dr1);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.ToolTip = (e.Row.DataItem as DataRowView)["Description"].ToString();
}
}