1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

newbie javascript question

Discussion in 'JavaScript' started by Dohmaker, Oct 30, 2007.

  1. #1
    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!
     
    Dohmaker, Oct 30, 2007 IP
  2. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #2
    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..
     
    KatieK, Oct 31, 2007 IP
  3. dadougalee

    dadougalee Peon

    Messages:
    589
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm not a microsoft drone... can't decrypt your asp.
     
    dadougalee, Oct 31, 2007 IP
  4. teraeon

    teraeon Peon

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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.
     
    teraeon, Nov 1, 2007 IP
  5. Dohmaker

    Dohmaker Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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.
     
    Dohmaker, Nov 1, 2007 IP