0

I am working on solution for Sharepoint 2010 c# and asp.net and need to open up a modal/pop up form on the click of a button. The form would contain some asp controls like the treeview and checkbox list. How can I do this?

Any pointers would be helpful!

Thanks in advance

user1256789
  • 131
  • 2
  • 5
  • 11

2 Answers2

1

For Opening Model/Popup

var options = SP.UI.$create_DialogOptions();options.width = 900;
options.height = 400;
options.resizable = 1;
options.scroll = 1;
options.url = '{SiteUrl}/_layouts/ApplicationPage.aspx';
SP.UI.ModalDialog.showModalDialog(options);

Now your application page

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ 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" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ApplicationPage.aspx.cs" Inherits="GetDocumentData.Layouts.GetDocumentData.SaveData" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

</asp:Content>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<asp:Button ID="Save" runat="server" OnClick="sendmsg_Click"  Text="Save"  />
    <asp:Label ID="Label1" runat="server" ></asp:Label>
</asp:Content>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
Application Page
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
My Application Page
</asp:Content>

Hope this is helpful for you.

Rony SP
  • 2,618
  • 15
  • 16
1

You can use SP.UI.ModalDialog.showModalDialog(options) Method for Displaying a modal dialog with specified dialog options, more details about how to use can be found here: SP.UI.ModalDialog.showModalDialog

SP Modal Dialog

Thanks, Deepak Semwal