开发者

Tooltip in GridView

开发者 https://www.devze.com 2023-01-18 18:45 出处:网络
What is the easiest way to include a tooltip in the gridView column? For example in this column <asp:BoundField DataField=\"short_comment\" Heade开发者_开发百科rText=\"Comments\" ReadOnly=\"True\

What is the easiest way to include a tooltip in the gridView column?

For example in this column

<asp:BoundField DataField="short_comment" Heade开发者_开发百科rText="Comments" ReadOnly="True" SortExpression="short_comment"/>

I would like to have something like

<asp:BoundField DataField="short_comment" ToolTipDataField="longer_comment"/>

Obviously the ToolTipDataField does not exist, but what would be the easiest way to achieve that functionality?


Replaced with template

<asp:TemplateField HeaderText="Comments" SortExpression="short_comment">
     <ItemTemplate>
         <asp:Label ID="Label1" runat="server" Text='<%# Bind("short_comment") %>' ToolTip ='<%# Bind("longer_comment") %>'></asp:Label>
     </ItemTemplate>
</asp:TemplateField>


e.Row.Cells[7].ToolTip = e.Row.Cells[7].Text;

i did something like that it seems worked. What i do is to show the content of cell as a tool tip. You can put some longer comments here.

I handled situtation from codebehind. No sure it is best solution.

hope it helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消