Dec 30, 2011

SharePoint 2010 Modal Dialog

Hi Guys,

This is a small post regarding the Sharepoint Modal Dialog. In this post I am going to expalin you how to call a Sharepoint Modal Dialog from the applications. For this demo I have taken the Sharepoint Project template in visual studio and added an application page to my project. And then I placed a hyper link on this page to call the modal dialog.

The class SP.UI.ModalDialog represents the modal dialog and the method showModalDialog displays the modal dialog with the dialog options which we provide. 

Here is the code (written in C# .cs file) to show the modal dialog by registering a script which calls the modal dialog

 string myScript = @"   var mymodalDialog; 
                                 function ShowDialogTest(myViewUrl) { 
                                    var options = { 
                                        url: myViewUrl, 
                                        tite: 'Demo Page', 
                                        allowMaximize: true, 
                                        showClose: true, 
                                        width: 600, 
                                        height: 400 }; 
                                       mymodalDialog = SP.UI.ModalDialog.showModalDialog(options); 
            ScriptManager.RegisterStartupScript(this, this.GetType(), ClientID, myScript, true);
            string strUrl = "";
            hLinkshow.NavigateUrl = "javascript:ShowDialogTest('" + strUrl + "')";

This is the output on click of hyperlink

You can find more on this from msdn.

Dec 1, 2011

Enabling Inline Editing for Share Point lists

You can edit the data of sharepoint lists in line mode. But this is specific to the view of the sharepoint list. Here is the way how to enable the inline editing for the list

This is my announcements list.

Click on List Tab in the Ribbon-->Select Modify View Button

Go to Inline Editing Category (below of Filter Category)

Check Allow the Inline Editing option. Go to your list back you will find this feature like this

On mouse Over of your list item you will find the edit icon, Click On and do the changes

The same way you can add the items inline.

Note : This feature is specific to your view(Here All Items). You can set this using code too.