Jump to content

Trouble Using A Button With The Repeater Ctrl


Recommended Posts

Help!! How do Cast this correctly?I have gotten all the Container.DataItems to work except the one for the BackColor. Text works fine with the single quotes around it. And the Span likes the Left and top values. But BackColor complains that "InvalidCastException was unhandled by usercode: Specified cast is not valid."I am trying to avoid the overhead of code behinds, so here is my code.

      <asp:Repeater ID="rpt_EOM_Chart" runat="server"  DataSourceID="SqlDataSource_ChartEOM">                 <ItemTemplate>            <span style="position:absolute; left:<%#Container.DataItem("IMG_POS_LEFT")%>; top:<%#Container.DataItem("IMG_POS_TOP")%>;">                      <asp:Button  Text='<%#Container.DataItem("NAME")%>' CssClass='<%#Container.DataItem("NAME")%>'                    runat="server" BorderStyle="Solid" Font-Bold="True" Font-Size="x-Small"                       OnClick="SetEOMView" BackColor=<%#Container.DataItem("TASK_STATUS_COLOR")%> />            </span>         </ItemTemplate>      </asp:Repeater>

Link to post
Share on other sites

ASP has actually been superseded - you are much better off learning ASP.NET.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...