texagg99 Posted January 23, 2010 Share Posted January 23, 2010 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 More sharing options...
texagg99 Posted January 23, 2010 Author Share Posted January 23, 2010 I do believe that this is the simplest solution.BackColor='<%#System.Drawing.ColorTranslator.FromHtml(Container.DataItem("TASK_STATUS_COLOR"))%>' I have been using ASP for about a week. This stuff is cool!! Link to comment Share on other sites More sharing options...
Synook Posted January 23, 2010 Share Posted January 23, 2010 ASP has actually been superseded - you are much better off learning ASP.NET. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.