SharePointAds TextOnly

Monday, 27 June 2011

SharePoint 2010 : Print Calendar list on a single click

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, updated 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",

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

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=""
        Title="Goto My Blog">     
        <UrlAction Url="javascript: function onClose(){ }
          var o = {
            url: '',
            title: 'MyBlog',
            allowMaximize: true,
            showClose: true,
            width: 700,
            height: 500,
            dialogReturnValueCallback: onClose

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 required Register Id here.
If you are not able to see modal dialog then change the <UrlAction> tag with following function.

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