一旦页面加载,阻止modalpopup在每次页面刷新或回发操作时显示。 [英] to prevent modalpopup from displaying at every page refresh or postback action once the page is loaded.
本文介绍了一旦页面加载,阻止modalpopup在每次页面刷新或回发操作时显示。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好专家,
你们真的做得很好,坚持下去。我是开发新手,所以我需要你的帮助。
这里是问题所在,我想阻止modalpopup在每次页面刷新或回发操作时发生错误。我需要你的帮助。下面是我的代码请帮助我。提前谢谢你。
Hello experts,
You guys are really doing a great job,keep it up. I''m new in development so i need your help.
here is the problem, i want to prevent a modalpopup from displying at every page refresh or postback action. please i need your help.below is my code please help me.Thank you in advance.
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ModalPopupControl.ascx.cs" Inherits="ModalPopup.ControlTemplates.ModalPopup.ModalPopupControl" %>
<SharePoint:ScriptLink ID="ScriptLink1" Name="SP.js" runat="server" önDemand="true" Localizable="false" />
<SharePoint:ScriptLink ID="ScriptLink2" Name="SP.UI.Dialog.js" runat="server" önDemand="true" Localizable="false" />
<SharePoint:FormDigest ID="FormDigest1" runat="server" />
<script type="text/javascript">
var currentContext = null;
var currentweb = null;
var listName = "Highlights";
var itemIDs = new Array();
ExecuteOrDelayUntilScriptLoaded(get_highlights, "SP.js");
function get_highlights() {
currentContext = new SP.ClientContext.get_current();
currentweb = currentContext.get_web();
var highlightList = currentweb.get_lists().getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<view><query>" +
"<orderby><fieldref name="Highlight_x0020_Priority" ascending="TRUE" /></orderby>" +
"<where><geq><fieldref name="Expires" /><value type="DateTime"><today /></value></geq></where>" +
"</query></view>");
this.collListItem = highlightList.getItems(camlQuery);
currentContext.load(collListItem);
currentContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed)
);
}
function onQuerySucceeded(sender, args) {
var listItemEnumerator = collListItem.getEnumerator();
var count = 0;
while (listItemEnumerator.moveNext()) {
var highlightItem = listItemEnumerator.get_current();
itemIDs[count] = highlightItem.get_id();
count = count + 1;
}
ExecuteOrDelayUntilScriptLoaded(displayModalDialog, "SP.UI.Dialog.js");
}
function onQueryFailed(sender, args) {
alert(''Request failed. '' + args.get_message() + ''\n'' + args.get_stackTrace());
}
function displayModalDialog() {
for (i = 0; i < itemIDs.length; i++) {
var offsetX = 5 + (i * 100);
var offsetY = 5 + (i * 10);
var options = {
url: "/_layouts/ModalPopup/Highlights.aspx?ItID=" + itemIDs[i],
width: 750,
height: 480,
title: "Highlights",
allowMaximize: true,
showClose: true,
x: offsetX,
y: offsetY
};
SP.UI.ModalDialog.showModalDialog(options);
}
}
//_spBodyOnLoadFunctionNames.push("portal_openModalDialog");
</script>
推荐答案
SharePoint.Project.AssemblyFullName
SharePoint.Project.AssemblyFullName
%>
<%@ Assembly Name =Microsoft.Web.CommandUI,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c%>
<%@注册Tagprefix =SharePointNamespace =Microsoft.SharePoint.WebControlsAssembly =Microsoft.SharePoint,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c%>
<%@ Register Tagprefix = UtilitiesNamespace =Microsoft.SharePoint.UtilitiesAssembly =Microsoft.SharePoint,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c%>
<%@ Register Tagprefix =asp Namespace =System.Web.UIAssembly =System.Web.Extensions,Version = 3.5.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35%>
<%@ Import Namespace =Microsoft.SharePoint %>
<%@ Register Tagprefix =WebPartPagesNamespace =Microsoft.SharePoint.WebPartPagesAssembly =Microsoft.SharePoint,Version = 14.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c%>
<%@ Control Language =C#AutoEventWireup =trueCodeBehind =ModalPopupControl.ascx.csInherits =ModalPopup.ControlTemplates.ModalPopup.ModalPopupControl%>
< SharePoint:ScriptLink ID =ScriptLink1Name =SP.jsrunat =serverönDemand=trueLocalizable =false/>
< SharePoint:ScriptLink ID =ScriptLink2Name =SP.UI.Dialog.jsrunat =serverönDemand=trueLocalizable =false/>
< SharePoint:FormDigest ID =FormDigest1runat =server/>
< script type =text / javascript>
var currentContext = null;
var currentweb = null;
var listName =亮点;
var itemIDs = new Array();
ExecuteOrDelayUntilScriptLoaded(get_highlights,SP.js);
函数get_highlights(){
currentContext = new SP.ClientContext.get_current();
currentweb = currentContext.get_web();
var highlightList = currentweb.get_lists()。getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(< view>< query>+
< orderby>< fieldref name =Highlight_x0020_Priorityascending =TRUE/>< / orderby> +
< where>< geq>< fieldref name =Expires/>< value type =DateTime>< today />< / value>< / geq> ;< / where>+
< / query>< / view>);
this.collListItem = highlightList.getItems(camlQuery);
currentContext.load(collListItem);
currentContext.executeQueryAsync(
Function.createDelegate(this,this.onQuerySucceeded),
Function.createDelegate(this,this.onQueryFailed)
);
}
函数onQuerySucceeded(sender,args){
var listItemEnumerator = collListItem.getEnumerator();
var count = 0;
while(listItemEnumerator.moveNext()){
var highlightItem = listItemEnumerator.get_current();
itemIDs [count] = highlightItem.get_id();
count = count + 1;
}
ExecuteOrDelayUntilScriptLoaded(displayModalDialog,SP.UI.Dialog.js);
}
函数onQueryFailed(sender,args){
alert(''请求失败。''+ args.get_message()+''\ n''+ args .get_stackTrace());
}
函数displayModalDialog(){
for(i = 0; i< itemIDs.length; i ++){
var offsetX = 5 +(i * 100);
var offsetY = 5 +(i * 10);
var options = {
url:/ _ layouts / MoviePopup / Highlights.aspx?Itt =+ itemIDs [i],
宽度:750,
身高:480,
title:要点,
allowMaximize:true,
showClose:true,
x:offsetX,
y:offsetY
};
SP.UI.ModalDialog.showModalDialog(options);
}
}
//_spBodyOnLoadFunctionNames.push(\"portal_openModalDialog);
< / script>
" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ModalPopupControl.ascx.cs" Inherits="ModalPopup.ControlTemplates.ModalPopup.ModalPopupControl" %> <SharePoint:ScriptLink ID="ScriptLink1" Name="SP.js" runat="server" önDemand="true" Localizable="false" /> <SharePoint:ScriptLink ID="ScriptLink2" Name="SP.UI.Dialog.js" runat="server" önDemand="true" Localizable="false" /> <SharePoint:FormDigest ID="FormDigest1" runat="server" /> <script type="text/javascript"> var currentContext = null; var currentweb = null; var listName = "Highlights"; var itemIDs = new Array(); ExecuteOrDelayUntilScriptLoaded(get_highlights, "SP.js"); function get_highlights() { currentContext = new SP.ClientContext.get_current(); currentweb = currentContext.get_web(); var highlightList = currentweb.get_lists().getByTitle(listName); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml("<view><query>" + "<orderby><fieldref name="Highlight_x0020_Priority" ascending="TRUE" /></orderby>" + "<where><geq><fieldref name="Expires" /><value type="DateTime"><today /></value></geq></where>" + "</query></view>"); this.collListItem = highlightList.getItems(camlQuery); currentContext.load(collListItem); currentContext.executeQueryAsync( Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed) ); } function onQuerySucceeded(sender, args) { var listItemEnumerator = collListItem.getEnumerator(); var count = 0; while (listItemEnumerator.moveNext()) { var highlightItem = listItemEnumerator.get_current(); itemIDs[count] = highlightItem.get_id(); count = count + 1; } ExecuteOrDelayUntilScriptLoaded(displayModalDialog, "SP.UI.Dialog.js"); } function onQueryFailed(sender, args) { alert(''Request failed. '' + args.get_message() + ''\n'' + args.get_stackTrace()); } function displayModalDialog() { for (i = 0; i < itemIDs.length; i++) { var offsetX = 5 + (i * 100); var offsetY = 5 + (i * 10); var options = { url: "/_layouts/ModalPopup/Highlights.aspx?ItID=" + itemIDs[i], width: 750, height: 480, title: "Highlights", allowMaximize: true, showClose: true, x: offsetX, y: offsetY }; SP.UI.ModalDialog.showModalDialog(options); } } //_spBodyOnLoadFunctionNames.push("portal_openModalDialog"); </script>
这篇关于一旦页面加载,阻止modalpopup在每次页面刷新或回发操作时显示。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文