标签:
调用页面(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>
标签:
原文地址:http://www.cnblogs.com/yinxiaopeng/p/4299485.html