Apply CSS for an HTML generic control like
    and
  • in ASP.NET

前端 未结 1 1897
余生分开走
余生分开走 2021-02-07 09:00

I don\'t know how to apply CSS for a HTML generic control like

    and
  • given runat=\"server\" in ASP.NET. I am finding
相关标签:
1条回答
  • 2021-02-07 09:24

    Please try this,

    ull.Style.Add("background-color", "Red");
    

    Or, I have tested this, will definitely work, please check

    ull.Attributes.Add("class", "yourClass");
    

    Edit: To test this solution I have provided you:

    1. make new blank master page and put <ul runat="server" id="ull">

    2. then add a new page and use the above master page.

    3. make findcontrol ul and put in CSS as I have mentioned in the answer.

    4. then run your page, and view source of your HTML page and you will find what you are looking for. Like

    0 讨论(0)
提交回复
热议问题