underlining a row in a repeater control

Discussion in 'ASP .Net' started by Robert Smith, Jun 19, 2008.

  1. Robert Smith

    Robert Smith Guest

    Hi I have a repeater control as shown below. The Itemtemplate contains a
    table with linkbuttons in each column of the row. However I wish to change
    the stlyle of the link button to
    text-decoration:underline on mouseover and
    text-decoration:none on mouseout

    The link button does not have a mouseover attribute and it won't let me add on
    Any idea how I can get around this problem.

    Thanx in advance
    Robert


    <ASP:Repeater id="MyRepeater" runat="server" >

    <ItemTemplate >
    <tr style="width:100%;background-color:FFECD8;" >
    <td >
    <asp:LinkButton id="lnkPages" style="text-decoration:none"
    runat="server" value='<%# DataBinder.Eval(Container.DataItem, "UserId")%>'
    Text = '<%# DataBinder.Eval(Container.DataItem, "UserId")%>'></asp:LinkButton>
    </td>
    <td>
    <asp:LinkButton id="LinkButton1" style="text-decoration:none"
    runat="server" value='<%# DataBinder.Eval(Container.DataItem, "UserName")%>'
    Text = '<%# DataBinder.Eval(Container.DataItem,
    "UserName")%>'></asp:LinkButton>
    </td>
    <td>
    <asp:LinkButton id="LinkButton2" style="text-decoration:none"
    runat="server" value='<%# DataBinder.Eval(Container.DataItem, "FirstName")%>'
    Text = '<%# DataBinder.Eval(Container.DataItem,
    "FirstName")%>'></asp:LinkButton>
    </td>
    <td>
    <asp:LinkButton id="LinkButton3" style="text-decoration:none"
    runat="server" value='<%# DataBinder.Eval(Container.DataItem, "LastName")%>'
    Text = '<%# DataBinder.Eval(Container.DataItem,
    "LastName")%>'></asp:LinkButton>
    </td>
    </tr>

    </ItemTemplate>

    <FooterTemplate>

    </table>

    </FooterTemplate>

    </ASP:Repeater>
    Robert Smith, Jun 19, 2008
    #1
    1. Advertising

  2. Add onmouseover and onmouseout attributes and ignore validation errors:
    onmouseover="this.style.textDecoration='underline'";
    onmouseout ="this.style.textDecoration='none'";

    If the validation errors anoy you too much, add the attributes in the code
    in any of these events: ItemCreated, ItemDataBound, PreRender:
    myLinkButton.Attributes["onmouseover "] =
    "this.style.textDecoration='underline'";
    myLinkButton.Attributes["onmouseout "] = "this.style.textDecoration='none'";

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "Robert Smith" <> wrote in message
    news:...
    > Hi I have a repeater control as shown below. The Itemtemplate contains a
    > table with linkbuttons in each column of the row. However I wish to change
    > the stlyle of the link button to
    > text-decoration:underline on mouseover and
    > text-decoration:none on mouseout
    >
    > The link button does not have a mouseover attribute and it won't let me
    > add on
    > Any idea how I can get around this problem.
    >
    > Thanx in advance
    > Robert
    >
    >
    > <ASP:Repeater id="MyRepeater" runat="server" >
    >
    > <ItemTemplate >
    > <tr style="width:100%;background-color:FFECD8;" >
    > <td >
    > <asp:LinkButton id="lnkPages" style="text-decoration:none"
    > runat="server" value='<%# DataBinder.Eval(Container.DataItem, "UserId")%>'
    > Text = '<%# DataBinder.Eval(Container.DataItem,
    > "UserId")%>'></asp:LinkButton>
    > </td>
    > <td>
    > <asp:LinkButton id="LinkButton1" style="text-decoration:none"
    > runat="server" value='<%# DataBinder.Eval(Container.DataItem,
    > "UserName")%>'
    > Text = '<%# DataBinder.Eval(Container.DataItem,
    > "UserName")%>'></asp:LinkButton>
    > </td>
    > <td>
    > <asp:LinkButton id="LinkButton2" style="text-decoration:none"
    > runat="server" value='<%# DataBinder.Eval(Container.DataItem,
    > "FirstName")%>'
    > Text = '<%# DataBinder.Eval(Container.DataItem,
    > "FirstName")%>'></asp:LinkButton>
    > </td>
    > <td>
    > <asp:LinkButton id="LinkButton3" style="text-decoration:none"
    > runat="server" value='<%# DataBinder.Eval(Container.DataItem,
    > "LastName")%>'
    > Text = '<%# DataBinder.Eval(Container.DataItem,
    > "LastName")%>'></asp:LinkButton>
    > </td>
    > </tr>
    >
    > </ItemTemplate>
    >
    > <FooterTemplate>
    >
    > </table>
    >
    > </FooterTemplate>
    >
    > </ASP:Repeater>
    >
    Eliyahu Goldin, Jun 19, 2008
    #2
    1. Advertising

  3. Robert Smith

    bruce barker Guest

    no javascript required, just use css:

    a:hover {text-decoration:underline; }

    -- bruce (sqlwork.com)


    "Robert Smith" wrote:

    > Hi I have a repeater control as shown below. The Itemtemplate contains a
    > table with linkbuttons in each column of the row. However I wish to change
    > the stlyle of the link button to
    > text-decoration:underline on mouseover and
    > text-decoration:none on mouseout
    >
    > The link button does not have a mouseover attribute and it won't let me add on
    > Any idea how I can get around this problem.
    >
    > Thanx in advance
    > Robert
    >
    >
    > <ASP:Repeater id="MyRepeater" runat="server" >
    >
    > <ItemTemplate >
    > <tr style="width:100%;background-color:FFECD8;" >
    > <td >
    > <asp:LinkButton id="lnkPages" style="text-decoration:none"
    > runat="server" value='<%# DataBinder.Eval(Container.DataItem, "UserId")%>'
    > Text = '<%# DataBinder.Eval(Container.DataItem, "UserId")%>'></asp:LinkButton>
    > </td>
    > <td>
    > <asp:LinkButton id="LinkButton1" style="text-decoration:none"
    > runat="server" value='<%# DataBinder.Eval(Container.DataItem, "UserName")%>'
    > Text = '<%# DataBinder.Eval(Container.DataItem,
    > "UserName")%>'></asp:LinkButton>
    > </td>
    > <td>
    > <asp:LinkButton id="LinkButton2" style="text-decoration:none"
    > runat="server" value='<%# DataBinder.Eval(Container.DataItem, "FirstName")%>'
    > Text = '<%# DataBinder.Eval(Container.DataItem,
    > "FirstName")%>'></asp:LinkButton>
    > </td>
    > <td>
    > <asp:LinkButton id="LinkButton3" style="text-decoration:none"
    > runat="server" value='<%# DataBinder.Eval(Container.DataItem, "LastName")%>'
    > Text = '<%# DataBinder.Eval(Container.DataItem,
    > "LastName")%>'></asp:LinkButton>
    > </td>
    > </tr>
    >
    > </ItemTemplate>
    >
    > <FooterTemplate>
    >
    > </table>
    >
    > </FooterTemplate>
    >
    > </ASP:Repeater>
    >
    bruce barker, Jun 19, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    5,116
    Darren Kopp
    Feb 22, 2006
  2. Kelwin Delaunay

    Inline Underlining in XHTML Strict?

    Kelwin Delaunay, Apr 26, 2004, in forum: HTML
    Replies:
    18
    Views:
    21,907
    greatbigmassive
    Sep 16, 2009
  3. Gillian White

    Hyperlinks With No Underlining

    Gillian White, Jun 7, 2004, in forum: HTML
    Replies:
    14
    Views:
    954
    Karl Groves
    Jun 7, 2004
  4. bernhard

    underlining <sup>

    bernhard, Nov 2, 2005, in forum: HTML
    Replies:
    17
    Views:
    3,484
    Alan J. Flavell
    Nov 5, 2005
  5. DC
    Replies:
    2
    Views:
    7,120
Loading...

Share This Page