List<User> lstUser = // some method to poplate your users
gUsers.DataSource = lstUsers;
gUsers.DataBind();
UMMMM... WAIT WHAT? How did i think you wanteda hyperlink. Anyways, ill leave this in there. If you want to apply it to the template, you can do it two ways that i can think of...
1. You can use a panel inside the Item Template and set width and height to 100% and set tootip to that.
2. Or you can provide a OnItemCreated Function for your GridView.
Then in that function use e.Items to apply atributes to the template. That will do it.
triggered
Contributor
3356 Points
908 Posts
Re: show tooltip in gridview
Jul 28, 2007 04:42 AM|LINK
What Object are you binding too? Since you didnt provide one, i will make it up. Lets call it Users, and it has properties UserName and FullName;
Pretend you want to show the Username in the link and ToolTip the FullName, you would do this...
<asp:GridView id="gUser" runat="server" autogeneratecolumns="False">
<Columns>
<TemplateField>
<asp:HyperLink id="hlUser" runat="server" text='<%# Eval("UserName") >' ToolTip='<%# Eval("FullName") %>' > </asp:HyperLink>
</TemplateField>
</Columns>
</asp:GridView>
// in your page load event do...
List<User> lstUser = // some method to poplate your users
gUsers.DataSource = lstUsers;
gUsers.DataBind();
UMMMM... WAIT WHAT? How did i think you wanteda hyperlink. Anyways, ill leave this in there. If you want to apply it to the template, you can do it two ways that i can think of...
1. You can use a panel inside the Item Template and set width and height to 100% and set tootip to that.
2. Or you can provide a OnItemCreated Function for your GridView.
Then in that function use e.Items to apply atributes to the template. That will do it.