locked
Add image to button header RRS feed

  • Question

  • User2016307720 posted

    I have tried to add a "gif" file to my button header in listview but am getting the following error.

    System.Web.UI.HtmlControls.HtmlTableCellCollection must have items of type 'System.Web.UI.HtmlControls.HtmlTableCell'. 'asp:Image' is of type 'System.Web.UI.WebControls.Image'

    The following is an extract of my code.

    <th runat="server" ID="cmdComputerName" align="left"><asp:Button runat="server" Font-Size="Small" Text="Computer Name" CommandName="Sort" CommandArgument="ComputerName" /></th>

     

    <asp:Image runat="server" ID="SortImage1" ImageUrl="~/images/up.gif" Visible="true" />

    How can I fix this?

    Sunday, September 14, 2008 2:01 PM

Answers

  • User-1757793930 posted

    sounds like a css question.

    try

    <th runat="server" style="background:url(/images/up.gif) repeat-x;" ID="cmdComputerName" align="left"><asp:Button runat="server" Font-Size="Small" Text="Computer Name" CommandName="Sort" CommandArgument="ComputerName" /></th>

     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, September 14, 2008 7:26 PM

All replies

  • User1841170908 posted

    Could you post a little more of your listview code.. Thanks.

    Sunday, September 14, 2008 4:02 PM
  • User-1757793930 posted

    sounds like a css question.

    try

    <th runat="server" style="background:url(/images/up.gif) repeat-x;" ID="cmdComputerName" align="left"><asp:Button runat="server" Font-Size="Small" Text="Computer Name" CommandName="Sort" CommandArgument="ComputerName" /></th>

     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, September 14, 2008 7:26 PM
  • User2016307720 posted

    It worked, but I guess the arrow in my picture was covered by my wordings. Anyway, thanks a lot for the help.

    Tuesday, September 16, 2008 9:31 AM