Results 1 to 2 of 2

Thread: DataGrid - which row am I on?

  1. #1

    Thread Starter
    Frenzied Member blindlizard's Avatar
    Join Date
    Feb 2001
    Location
    Austin, TX - United States of America
    Posts
    1,141

    DataGrid - which row am I on?

    Ok, I am a ASP.Net noob so bear with me. I have a DataGrid in which I have a column where I have an image of which I get the path to from my database. Everything works fine to this point. Now, I want to add a JavaScript that I found to have a DHTML tooltip come up when you mouse over the image. The javascript takes an array ("Title", "Text") to create the tooltip. Now, when I am binding the DataGrid, I need to have a line just before the image that is
    Code:
    <script language="javascript">Text[0]="MyTitle","MyText"</script>
    where the index of Text[] changes for each row in my grid. Then bind the image
    VB Code:
    1. <asp:datagrid id="dgReviews" runat="server">
    2.    <Columns>
    3.        <asp:TemplateColumn HeaderText="Game">
    4.     <ItemTemplate>
    5.          <asp:HyperLink ID="lnkGameTitle" Runat="server" NavigateUrl=<%# "Reviews.aspx?GameID=" & trim(Container.DataItem("GameID")) & "&ReviewerID=" & trim(Container.DataItem("ReviewerID"))%>></asp:HyperLink>
    6.                  </ItemTemplate>
    7.         </asp:TemplateColumn>
    8.                 <ItemTemplate>
    9.           <asp:Image id="imgESRB" onMouseOver="myjscriptfunction(Text[0])" runat="server" ImageUrl=<%# Container.DataItem("ESRBThumb")%>></asp:Image>
    10.     </ItemTemplate>
    11.         </asp:TemplateColumn>
    12.      </Columns>
    13. </asp:datagrid>
    Last edited by blindlizard; Nov 21st, 2004 at 04:34 PM.
    I drink to make other people more interesting!
    [vbcode]On Error GoTo Bar[/vbcode]
    http://www.monsterlizard.com

  2. #2
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    DataGridItem.ItemIndex
    Reference it like this:
    Code:
    <%# Container.ItemIndex %>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width