SharePointAds TextOnly

Monday, 27 June 2011

Do you want to print SharePoint 2010 list at a single click?
Yes, now you can print your SharePoint 2010 list in single click using SPPrintListButton solution.
I have provided Sandbox solution which will add new "Print" button on the top ribbon for SharePoint List. As of now I have created for Calendar lists.
Print List Button


Please have a look at my codeplex solution to download and install feature in your SharePoint 2010 list.
CodePlex Solution: Download From CodePlex

Important Update: After lots of print button image view error requests, u pdated solution to work with subsites calendar lists. Please visit at same CodePlex page to download updated version.
And let me know if you get previous error again.
.

Thursday, 9 June 2011

SharePoint 2010 : how to open Modal Dialog in ECB Menu

You can open model dialog in SharePoint site using the following code:

< script type ="text/javascript">
function openDialog() {
var options = {
url: "demopage.aspx" ,
width: 600,
height: 300,
title: "My PopUp" ,
};
SP.UI.ModalDialog.showModalDialog(options);
}

< / script >
< div >
< a onclick ="javascript:openDialog(); return false;"> Click Here a >
< asp : Button ID ="btnDialog" runat ="server" Text ="Open Dialog" OnClientClick ="javascript:openDialog(); return false;"/>
< / div >

But what if you want to open dialog from ECB menu? Create new custom action in Element.xml file and in UrlAction tag use the following javascript function.

< Elements xmlns = " http://schemas.microsoft.com/sharepoint/ " >
< CustomAction
Id = " {B0B5A0CB-7FBE-4dd6-9B2A-2B1E1321B8F9} "
RegistrationType = " List "
RegistrationId = " 101 "
Location = " EditControlBlock "
Title = " Goto My Blog " >
< UrlAction Url = " javascript: function onClose(){ }
var o = {
url: 'http://www.niteen.co.cc',
title: 'MyBlog',
allowMaximize: true,
showClose: true,
width: 700,
height: 500,
dialogReturnValueCallback: onClose
};
SP.UI.ModalDialog.showModalDialog(o); " />
< / CustomAction >
< / Elements >

In above code, I created new ECB menu for “Document library”, you can create ECB menu for any lists by changing RegistrationId , you can find all .
If you are not able to see modal dialog then change the < UrlAction> tag with following function.

< UrlAction Url = " javascript:(function () {
var o = {
url:'http://www.niteen.co.cc',
title: 'MyBlog',
allowMaximize: true,
showClose: true,
width: 700,
height: 500
};
SP.UI.ModalDialog.showModalDialog(o); }) (); " />