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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...