如何在其webpart代码隐藏中访问sharepoint aspx中的div

时间:2012-11-09 08:38:08

标签: asp.net sharepoint-2010 web-parts

我有一个带有webpart的aspx sharepoint页面。如何将display = none设置为webpart codebehind(ascx.cs)中页面(aspx)中的div。

代码:

<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();                                                                                       

我想隐藏GearPage div并在DisplayReportWebPart webpart代码隐藏中显示Master div。

1 个答案:

答案 0 :(得分:0)

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