【问题标题】:How to access div in sharepoint aspx in its webpart codebehind如何在其 webpart 代码隐藏中访问 sharepoint aspx 中的 div
【发布时间】:2012-10-29 13:41:32
【问题描述】:

我有一个带有 webpart 的 aspx 共享点页面。如何在 webpart 代码隐藏 (ascx.cs) 内的页面 (aspx) 中将 display=none 设置为 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 代码隐藏中显示主 div。

【问题讨论】:

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


    【解决方案1】:

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

    【讨论】:

    • 刚刚试过。如果我给 runat 给出错误“此文件中不允许使用代码块”。获取客户端ID时
    猜你喜欢
    • 2011-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多