468,278 Members | 1,482 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,278 developers. It's quick & easy.

tooltip for each row in grid view

hi all,

i have a grid view where am displaying data from dataset. My dataset
consists of columns Customer name, surname, date requested, sales person,
file number , status and comments
I am displaying all columns in grid view except comments.

Now I want to have comments displayed (for each row) as tooltip when u hover
over particular row.

Does anybody know the code for this ?

thanks
puja
Aug 1 '06 #1
2 9191


I've done it with a Web datagrid. The grid has a value column that's
hidden and a button that's visible. If the value column is empty it
shows the button. If the value is there it shows who pressed the button
and the tooltip is shown if notes were attached. In the ItemDataBound
event I get the underlying data to use to make desicions. I create a
label control on the fly and use it's ToolTip to show the tooltip. I
also wanted a different cursor so that's there also.

private void dgBids_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if((e.Item.ItemType.ToString() == "Item" || e.Item.ItemType.ToString()
== "AlternatingItem") || e.Item.ItemType.ToString() == "EditItem")
{
DataRowView drv = (DataRowView)e.Item.DataItem;
string sRejected = e.Item.Cells[5].Text.Trim().Replace(" ","");
Button btnDis = (Button)e.Item.Cells[6].Controls[0];
if(sRejected.Length == 0 || sRejected.Equals("0"))
{
btnApp.Visible = false;
Label lb = new Label();
lb.Text = "Appr. by " + drv.Row["Approver"].ToString();
string tt = drv.Row["SupervisorNotes"].ToString();
if(tt.Length)
{
lb.ToolTip = tt;
lb.Style.Add("cursor","url('comment.cur')");
}
e.Item.Cells[4].Controls.Add(lb);
}
}
}

Hope that Helps
*** Sent via Developersdex http://www.developersdex.com ***
Aug 2 '06 #2


Sorry, I forgot. If you want to just deal with mouseover on the TR
(row) Dino Esposito has a great article about using CSS behaviors to get
a rowover type highlight. It does require you override the datagrid in
NET 1.1, but his examples help a lot to understand what you can do with
behaviors.

http://msdn.microsoft.com/msdnmag/is...3/CuttingEdge/

Again, hoping this helps

*** Sent via Developersdex http://www.developersdex.com ***
Aug 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Lars Netzel | last post: by
11 posts views Thread by Webster | last post: by
5 posts views Thread by Pavan | last post: by
3 posts views Thread by =?Utf-8?B?UmFq?= | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.