Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Setting BackColor of pannel

Setting BackColor of pannel

Scheduled Pinned Locked Moved ASP.NET
databasehelpcsharpasp-netsysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Armandt__
    wrote on last edited by
    #1

    Hi , ive got a asp.net vb web app, now i save a color code the a sql database and the show the data in a c1webgrid, now what i want to do is put a panel in template column and set the backcolor of the panel acording to what is in the database Now what i did was C1WebGrid:C1TemplateColumn    <ItemTemplate>       <asp:Panel ID="Panel4" runat="server"             BackColor='<%# Eval("ColorCode") %>' Height="20px" Width="20px>             asp:Panel    </ItemTemplate> </C1WebGrid:C1TemplateColumn> but it gives me a System.InvalidCastException: Specified cast is not valid error if someone can please help me with this, Thanks

    D 1 Reply Last reply
    0
    • A Armandt__

      Hi , ive got a asp.net vb web app, now i save a color code the a sql database and the show the data in a c1webgrid, now what i want to do is put a panel in template column and set the backcolor of the panel acording to what is in the database Now what i did was C1WebGrid:C1TemplateColumn    <ItemTemplate>       <asp:Panel ID="Panel4" runat="server"             BackColor='<%# Eval("ColorCode") %>' Height="20px" Width="20px>             asp:Panel    </ItemTemplate> </C1WebGrid:C1TemplateColumn> but it gives me a System.InvalidCastException: Specified cast is not valid error if someone can please help me with this, Thanks

      D Offline
      D Offline
      DoctorMick
      wrote on last edited by
      #2

      Try Eval("ColorCode").ToString()?

      A 1 Reply Last reply
      0
      • D DoctorMick

        Try Eval("ColorCode").ToString()?

        A Offline
        A Offline
        Armandt__
        wrote on last edited by
        #3

        got it right, i put ,   <%# System.Drawing.ColorTranslator.FromHtml(Eval("ColorCode")) %> thanks anyway.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups