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. HOW to persist data with color in dropdownlist control

HOW to persist data with color in dropdownlist control

Scheduled Pinned Locked Moved ASP.NET
csharpquestionasp-netdatabasesql-server
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.
  • M Offline
    M Offline
    mohd imran abdul aziz
    wrote on last edited by
    #1

    Hi all, I am using asp.net2.0 , C# and sql server 2005. When i fill the dropdownlist with two color based on contdtion in recordset it fill successfully but on seletedindex _change those color vanish but record remains. how can i persist data with color ? the code i used to fill the data is foreach (DataRow row in dtcompany.Rows) { if (row["HM_TRG_FLAG"].Equals(true) ) { ListItem item = new ListItem(row[1].ToString(), row[0].ToString()); // item.Attributes.Add("Tooltip", row[1].ToString()); item.Attributes.Add("style", "color:GREEN"); ctrl.Items.Add(item); //ctrl.Items.Add(new ListItem(ctrl.Items.Add(item);, row[0].ToString())); } else { ListItem item = new ListItem(row[1].ToString(), row[0].ToString()); // item.Attributes.Add("style", "color:RED"); item.Attributes.Add("Tooltip", row[1].ToString()); ctrl.Items.Add(item); } }

    regards imran khan

    S 1 Reply Last reply
    0
    • M mohd imran abdul aziz

      Hi all, I am using asp.net2.0 , C# and sql server 2005. When i fill the dropdownlist with two color based on contdtion in recordset it fill successfully but on seletedindex _change those color vanish but record remains. how can i persist data with color ? the code i used to fill the data is foreach (DataRow row in dtcompany.Rows) { if (row["HM_TRG_FLAG"].Equals(true) ) { ListItem item = new ListItem(row[1].ToString(), row[0].ToString()); // item.Attributes.Add("Tooltip", row[1].ToString()); item.Attributes.Add("style", "color:GREEN"); ctrl.Items.Add(item); //ctrl.Items.Add(new ListItem(ctrl.Items.Add(item);, row[0].ToString())); } else { ListItem item = new ListItem(row[1].ToString(), row[0].ToString()); // item.Attributes.Add("style", "color:RED"); item.Attributes.Add("Tooltip", row[1].ToString()); ctrl.Items.Add(item); } }

      regards imran khan

      S Offline
      S Offline
      Sandeep Akhare
      wrote on last edited by
      #2

      Check the default setting of drop downlist remove if drop down list have default settings

      Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

      M 1 Reply Last reply
      0
      • S Sandeep Akhare

        Check the default setting of drop downlist remove if drop down list have default settings

        Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

        M Offline
        M Offline
        mohd imran abdul aziz
        wrote on last edited by
        #3

        i did not get what do you mean by default setting is it viewstate please reply.

        regards imran khan

        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