hi everyone, This is the first time I try to add javascript to my webpage. What I want to do is basically add a tooltip to rows in a gridview. Now, I found this link which generates the code for me: http://www.guistuff.com/tooltipgen.shtml copy/pasting the tooltip code worked fine. However, I do not get how to add this code to my gridview: <a href="javascript:void(0)" onMouseover="EnterContent('ToolTip','Tooltip Title','Tooltip Content'); Activate();" onMouseout="deActivate()">ToolTip Me</a> Code (markup): so I have to tag this to this object: <asp:GridView Style="left: 186px; position: absolute; top: 171px" ID="GridView" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourceRemote" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Width="335px" Height="119px" OnRowDataBound="GridView_RowDataBound" DataKeyNames="CA_Name" Font-Names="Verdana" Font-Size="Small"> <RowStyle ForeColor="#000066" /> <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /> <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" /><FooterStyle BackColor="White" ForeColor="#000066" /> <Columns> <asp:BoundField DataField="CA_Name" HeaderText="Competency Area" SortExpression="CA_Name" /> <asp:BoundField DataField="Week_of_Availability" HeaderText="Week" SortExpression="Week_of_Availability" > <ItemStyle HorizontalAlign="Right" /> </asp:BoundField> <asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" /> <asp:BoundField DataField="Date_of_entry" HeaderText="Date of Entry" SortExpression="Date_of_entry" DataFormatString="{0:M-dd-yyyy}" HtmlEncode="False" /> </Columns> </asp:GridView> Code (markup): how do I do this? Thanks for your help!
Sorry, I can't read your ASP code to see where it creates the table cells. I recommend that you post this question in the ASP forum..
You need to add a TemplateField into your Gridview, within that template field add your tooltip code <a href="javascript:void(0)" onMouseover="EnterContent('ToolTip','Tooltip Title','Tooltip Content'); Activate();" onMouseout="deActivate()">ToolTip Me</a> now probably each record is going to have a different tool tip, so you will have to put a binding on the tooltip title and content.
thanks teraeon, but unfortunately when I tried that I got an error message saying: Validation (Internet Explorer 6): The element 'a' cannot be nested within the element 'templatefield'. and thanks for precising that, Katiek I'll try the asp forum.