subash
subash

Reputation: 4137

set tool tip for each cell of a devexpress gridview

how to set tool tip for each cell of a devexpress gridview in asp.net & c#.net

Upvotes: 0

Views: 7634

Answers (2)

Caleb Postlethwait
Caleb Postlethwait

Reputation: 151

Same concept as mhughes but in my case the gridView is dynamically created so I had to add the event handler after the fact.

_gridview.HtmlDataCellPrepared += new ASPxGridViewTableDataCellEventHandler(_gridview_HtmlDataCellPrepared);

void _gridview_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e)
{
     if (e.CellValue != null)
         e.Cell.Attributes.Add("title", e.CellValue.ToString());
}

Upvotes: 0

matthughes404
matthughes404

Reputation: 2476

First, set the "OnHtmlDataCellPrepared" property of your grid, like this:

<dx:ASPxGridView ID="ASPxGridView1" runat="server" 
    OnHtmlDataCellPrepared="ASPxGridView1_HtmlDataCellPrepared">
</dx:ASPxGridView>

Then set the "title" attribute of the cells in your codebehind:

protected void ASPxGridView1_HtmlDataCellPrepared(object  sender,  DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs  e)  
{
    e.Cell.Attributes.Add("title", "Your Tooltip");
}

Upvotes: 2

Related Questions