locked
Get Html element from WebForm to user control RRS feed

  • Question

  • I have a web form with multiple User control.

    I have a save button inside a user control when user press save button i want to cange the style of <li> that is inside a form

    webform.aspx

    </head>
    <body>
        <form id="form1" runat="server">
         <ul>
            <li runat="server" ID="li1" style="">01. Step 1 </li>
            <li runat="server" ID="li2">02. Step 2 </li>
            <li runat="server" ID="li3">03. Step 3 </li>
            <li runat="server" ID="li4">04. Step 4 </li>
            <li runat="server" ID="li5">05. Step 5</li>
          </ul>
    
         <div id="left2">
                        <uc1:Step1 ID="Step1" runat="server" />
         </div>
         <div id="left2">
                        <uc2:Step1 ID="Step2" runat="server" />
         </div>
         <div id="left2">
                        <uc3:Step1 ID="Step3" runat="server" />
         </div>
         <div id="left2">
                        <uc4:Step1 ID="Step4" runat="server" />
         </div>
        </form>
    </body>
    
    //-------------------------------Inside User Control Step1-------------------------
    
    <asp:ImageButton ID="btnSave" runat="server" ImageUrl="~/Images/save.png"    onclick="btnSave_Click1" />

    in code behind  on button click i get the li (list item) then its id and applying style

    HtmlGenericControl li1 = new HtmlGenericControl("li");
                    li1.ID = "li1";
                    li1.Attributes.Add("style", "background:url(../Images/buttons.png); background-repeat:no-repeat;");
    
    HtmlGenericControl li2 = new HtmlGenericControl("li");
                    li2.ID = "l12";
                    li2.Attributes.Add("style", "background:url(../Images/active-button-current.png); background-repeat:no-repeat;");

    its not changeing the style of list item......


    Abdul Jabbar

    Monday, August 5, 2013 4:48 AM

All replies

  • Is this a Microsoft Dynamics CRM question? I think you may have the wrong forum.

    If my response helped you find your answer please show your thanks by taking the time to "Mark As Answer" and "Vote As Helpful".

    Twitter LinkedIn Facebook Blog Magnetism

    Sunday, August 11, 2013 8:09 AM