简体   繁体   中英

How to access div in sharepoint aspx in its webpart codebehind

i have an aspx sharepoint page with webpart. how to set display=none to a div in the page(aspx) inside the webpart codebehind(ascx.cs).

code:

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript">
function ShowGearPage() {
    var gearPage = document.getElementById("GearPage");
    gearPage .style.display = "block";

    var loginPage = document.getElementById("MasterTable");
    loginPage.style.display = "none";
    return true;
}
    </script>


    <div align="center" id="GearPage" style="display:none;">
<div id="s4-simple-card" class="s4-simple-gearpage">
    <div id="s4-simple-card-content">
        <h1>
            <img id="gearsImage" alt="This animation indicates the operation is in progress."
                src="gears_anv4.gif" style="width: 24px; height: 24px; font-size: 0px;"
                align="middle" />
            Processing...
        </h1>
        <div>

        </div>

    </div>
</div>

ShowGearPage();

I want to hide the GearPage div and show the Master div in the DisplayReportWebPart webpart codebehind.

runat="server"添加到div并使用divId.Attributes("Style","display:none");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM