set Different colors in asp:DropDownList Items

前端 未结 3 1623
滥情空心
滥情空心 2021-01-22 10:49

I have an in my form, with 4 different options (items) What I need to do it\'s to set a different color from client side, without PostBack.

Items:

  • Selec
3条回答
  •  囚心锁ツ
    2021-01-22 10:58

    This is what worked for me...

    ListItem listItem = new ListItem();
    listItem.Attributes.Add("style", "background-color: Gold !important;");
    listItem.Text = "Apply for funding";
    
    dlPayment.Items.Add(listItem);
    

提交回复
热议问题