Archive for the ‘video tutorial’ Category

How to use SharePoint modal dialog box to display Custom Page Part2

May 23, 2012 Leave a comment

In the first part of the series, I showed you how to display and close a custom page in a SharePoint modal dialog using JavaScript. In this one, I’d like to show you how to display some information after the Modal dialog is closed.You can download the source code here.

1. Firstly, modify the element file as follow

<Elements xmlns="">
<CustomAction Id="ReportConcern"
Title="Display Custom Page"
Description="To Display Custom Page in a modal dialog box on this item">
<UrlAction Url="javascript:
function emitStatus(messageToDisplay) {
statusId = SP.UI.Status.addStatus(messageToDisplay.message + ' ' +messageToDisplay.location );
SP.UI.Status.setStatusPriColor(statusId, 'Green');
function portalModalDialogClosedCallback(result, value) {
if (value !== null) {
var options = {
url: '{SiteUrl}' + '/_layouts/YBBEST/TitleRename.aspx?List={ListId}&amp;ID={ItemId}',
title: 'Rename title',
allowMaximize: false,
showClose: true,
width: 500,
height: 300,
dialogReturnValueCallback: portalModalDialogClosedCallback };
SP.UI.ModalDialog.showModalDialog(options);" />

2. In your code behind, you can implement a close dialog function as below. This will close your modal dialog box once the button is clicked and display a status bar.

protected static string GetCloseDialogScript(string message)
var scriptBuilder = new StringBuilder();
scriptBuilder.Append("<script type='text/javascript'>" + "SP.UI.ModalDialog.commonModalDialogClose(1,").Append(message).Append("); </script>");
return scriptBuilder.ToString();
Categories: SharePoint, video tutorial

Video Tutorial(Continuous Updating)

January 4, 2010 Leave a comment
Categories: video tutorial