Dynamically changing css class name

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suganya
    New Member
    • Dec 2006
    • 39

    Dynamically changing css class name

    hi

    I have a link button with css class name as "ButtonIE". Once if i select the dropdownlist value as blue, I want to have css class name as "ButtonIE1" dynamically.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    So change the CssClass in the SelectedIndexCh anged event of the DropDownList. It's just a string:
    Code:
    //event handler for dropdown list selectedindexchanged
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        LinkButton1.CssClass = "ButtonIE1";
        //or you could get the value from the ddl:
        LinkButton1.CssClass = DropDownList1.SelectedValue;
    }

    Comment

    Working...