码迷,mamicode.com
首页 > 其他好文 > 详细

调用sharepoint自带模态窗口

时间:2015-02-25 14:07:30      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

调用页面(NewList)

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewListUserControl.ascx.cs" Inherits="TestDemo1.WebParts.NewList.NewListUserControl" %>

<script type="text/javascript">
function showDialog() {
var options = {
url: "/_layouts/Page/UPLoadPage.aspx",
args: 7,
title: "选择页面",
width: 200,
heigth:200,
dialogReturnValueCallback: dialogCallback
};
SP.UI.ModalDialog.showModalDialog(options);
}

//接收返回值方法
function dialogCallback(dialogResult, returnValue) {
//其中dialogResult=1,代表确定,dialogResult=0,代表关闭
if (returnValue != null && dialogResult == 1) {
alert(returnValue); //弹出窗口
document.getElementById(‘txt_shuru‘).value = returnValue;
}
return;
}
</script>
<div>
<input type="text" id="txt_shuru"/>
<input type="button" id="Btn_xuanze" value="选择" onclick="showDialog()"/>

</div>

被调用页面(弹出的页面UPLoadPage.aspx)

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UPLoadPage.aspx.cs" Inherits="TestDemo1.Layouts.Page.UPLoadPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>大爷的</title>
<script type="text/javascript">
//返回值方法
function ReturnPageValue() {
window.frameElement.commitPopup(document.getElementById(‘txt_Name‘).value);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td><span>名字:</span><input type="text" id="txt_Name" />
</td>
</tr>
<tr>
<td>
<input type="button" value="确定" id="sure" onclick="ReturnPageValue()" />
</td>
</tr>
</table>
</form>
</body>
</html>

调用sharepoint自带模态窗口

标签:

原文地址:http://www.cnblogs.com/yinxiaopeng/p/4299485.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!