DataGridViewRow Alternate Text

D

doomsday123

I want to add alternate text like on an html image to a
DataGridViewRow. Is it possible?
 
J

Jeremy Ames

It is definitely possible. It just depends on how everything is setup. Can
you post some code?
 
D

doomsday123

It is definitely possible. It just depends on how everything is setup. Can
you post some code?

Im just binding a data table to the grid. I think i need to use the
ControlAdded event of the grid to catch all the rows being added but I
dont know how to add the mouseover text to the control.
 
M

Mark Rae [MVP]

Anyone know how I can get the mouseover text on the DataGridViewRows?

Not sure precisely what you're trying to do - when you move the mouse over
the rows, what are you expecting to happen, exactly...?

However, the following might give you a push in the right direction:

<asp:GridView ID="MyGridView" runat="server"
OnRowDataBound="MyGridView_RowDataBound" .......>
........
</asp:GridView

protected void MyGridView_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover",
"this.style.backgroundColor=\"black\"");
}
}

I'm sure you can adapt it for your specific requirements...
 
D

doomsday123

I figured out how to get what I wanted. It is the tooltip that i want
and you cant put it on a row but you can put it on cells within that
row so i just loop through all the cells of that row and set the
tooltip to the same thing on each cell so it seems like the entire row
was the tooltip.
 
M

Mark Rae [MVP]

I figured out how to get what I wanted. It is the tooltip that i want
and you cant put it on a row but you can put it on cells within that
row so i just loop through all the cells of that row and set the
tooltip to the same thing on each cell so it seems like the entire row
was the tooltip.

Ah right. The thing to remember here is that a GridView is rendered as an
HTML table so the rows are <tr> and the cells are <td>...

Glad you got it sorted...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top