How to change image in repeater header

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sandeep akhare
    New Member
    • May 2006
    • 29

    How to change image in repeater header

    Hi All
    i have a repeater control in that i have to coulmns i need to sorts those columns i am able to sort but according to sorting asscending or descending
    i need to change the image in the header How to go for it ?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by Sandeep akhare
    Hi All
    i have a repeater control in that i have to coulmns i need to sorts those columns i am able to sort but according to sorting asscending or descending
    i need to change the image in the header How to go for it ?

    What have you tried so far?

    -Frinny

    Comment

    • Sandeep akhare
      New Member
      • May 2006
      • 29

      #3
      Originally posted by Frinavale
      What have you tried so far?

      -Frinny
      I am unable to get access to the header controls below is my header control
      [code=asp]
      <asp:Repeater ID="Repeater1" runat="server" >
      <HeaderTempla te >
      <table cellspacing="0" cellpadding="0" border="0" style="width: 100%; border-collapse: collapse;">
      <tr>
      <td class="tanrow" align="Left">
      <asp:LinkButt on id="lnkPartID" OnClick="SortCo mmand" OnClientClick=" hideId();" runat="server" CommandArgument ="ID">ID</asp:LinkButton>
      <asp:Image ID="ImageID" runat="server" ImageUrl="~/Images/IconArrowDown.g if" />
      </td>
      <td align="Left">
      <asp:LinkButt on id="lnkPartName " runat="server" OnClick="SortCo mmand" CommandArgument ="Name">Name </asp:LinkButton>

      <asp:Image ID="ImageName" runat="server" ImageUrl="~/Images/IconArrowUp.gif "/>
      </tr>
      </HeaderTemplate>
      <ItemTemplate >
      <tr id="DataRow" runat="server">
      <td align="Left" >
      <%# (DataBinder.Eva l(Container.Dat aItem, "ID"))%>
      </td>
      <td align="Left" >
      <%# (DataBinder.Eva l(Container.Dat aItem, "Name"))%>
      </td>
      </tr>
      </ItemTemplate>

      <FooterTemplate >
      </table>
      </FooterTemplate>
      </asp:Repeater>[/code]
      Last edited by Frinavale; Oct 17 '07, 01:17 PM. Reason: Added [code] tags to make more legible

      Comment

      • AxleWacl
        New Member
        • Oct 2007
        • 3

        #4
        Where you use your databinder.eval ...... Try something in the line of the code below:(This is for vs.net 2003, not sure if it will work for 2005,but should)

        [code=asp]
        <td><a href='story.asp x?s=<%# DataBinder.Eval (Container.Data Item, "makeid") %>' ><img border=0 src='assets/images/<%# DataBinder.Eval (Container.Data Item, "make") %>.jpg' height=55 width=65/></a>[/code]

        Basicall what is happening, the...[code=asp]<td><a href='story.asp x?s=<%# DataBinder.Eval (Container.Data Item, "makeid") %>[/code]...is reading the "headline" name from the Database, which displays is by the MAKEID and forwards you to the Story.aspx page with the MAKEID, the...[code=asp]<img border=0 src='assets/images/<%# DataBinder.Eval (Container.Data Item, "make") %>.jpg' height=55 width=65/>[/code]... Displays the IMAGE stored in my assets/images folder, which is found by the Make. So you have the image now next to the corresponding headline.....

        Hope this helps
        Last edited by Frinavale; Oct 17 '07, 01:19 PM. Reason: Added [code] tags to make more legible

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Thanks for your help AxleWacl!

          Could you both please use &#91; code] tags when posting code.
          An example of posting C# code:
          &#91; code=cpp]
          //My C# code here
          &#91; /code]

          An example of posting VB.NET code:
          &#91; code=vbnet]
          'My Vb.NET code here
          &#91; /code]

          Thank you!
          -Moderator

          Comment

          Working...