Thursday, May 23, 2013

Model dialogues,Refresh Parent, Pop-Up Window for SharePoint


Add New Items:

hyperLink.NavigateUrl = "javascript:SP.UI.ModalDialog.ShowPopupDialog('" + url + "')";



Dialog with Parent page refresh while closing Popup:


function openDialog() {
        var siteUrl = _spPageContextInfo.siteAbsoluteUrl;
        var libOrFolderURL = document.getElementById("<%=lblBreadCrumb.ClientID %>").innerHTML;
        var completeUrl = siteUrl + "/" + libOrFolderURL;            
        if (typeof libOrFolderURL !== 'undefined' && libOrFolderURL != "") {
            var options = {
                url: completeUrl,
                allowMaximize: true,
                width: 800,
                height: 700,
                title: "Upload, add, Edit, Apply category..",
                dialogReturnValueCallback: function (completeUrl) {                                   
                location.reload();
                }
            };
            SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
        }
        return false;

    }




====================@===============================




Message Box:
  string script = "<script language='javascript'>alert('Field are emply ')</script>";
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "Register", script);
(or)

string script = "<script language='javascript'>alert('" + errorMessage + "')</script>";
Page.ClientScript.RegisterClientScriptBlock(GetType(), "Register", script);

============================@============================




Add Link Under Personal Action:

<CustomAction
Id="By_RKU_ChangeMyPW_ActionsMenu"
    Title="Change Password"
Description="Change your Domain Password"
     GroupId="PersonalActions"
     Location="Microsoft.SharePoint.StandardMenu"

ImageUrl="~site/_layouts/images/SharePointFix/water.gif">
<UrlAction Url="javascript:(function () { var o = { url:'{SiteUrl}/_LAYOUTS/ChangePw/ChangePassword.aspx', title: 'Select List Item', dialogReturnValueCallback: SP.UI.ModalDialog.RefreshPage }; SP.UI.ModalDialog.showModalDialog(o); }) ();"/>

</CustomAction>


(Or)


 <CustomAction
   Id="By_RKU_ChangeMyPW_ActionsMenu"
   Title="Change Password"
   Description="Change your Domain Password"
   GroupId="PersonalActions"
   Location="Microsoft.SharePoint.StandardMenu"
    Sequence="1000">
   <UrlAction Url="_LAYOUTS/ChangePw/ChangePassword.aspx"/>  
  </CustomAction>

---------------------------------------------------------------------------------------------------


In SharePoint :


<CustomAction
    Id="{B0B5A0CB-7FBE-4dd6-9B2A-2B1E1321B8F9}"
    RegistrationType="List"
    RegistrationId="101"
Location="EditControlBlock"
Title="Change Password">
 <UrlAction Url="javascript: function onClose(){ } 
       var o = { 
  url: '{SiteUrl}/_layouts/ChangePw/ChangePassword.aspx',
 title: 'Password Rest Tool',
 allowMaximize: true,
 showClose: true,
 width: 400,
 height: 300,
 dialogReturnValueCallback: onClose
 };
 SP.UI.ModalDialog.showModalDialog(o);"/>
  </CustomAction>

Tuesday, May 7, 2013

Calculate column Conditions with marks grade.

Calculated Column in SharePoint
Student Percentage:


=IF([Percentage]>=0.95,"A",IF([Percentage]>=0.88,"B",IF([Percentage]>=0.81,"C",IF([Percentage]>=0.75,"D",IF([Percentage]>=0.74,"F")))))




==================================================
columns value (Questions) based  on another column (Role) selections:

If you select Developer, Question value should be 26.




=IF(Role="Architects",34,
IF(Role="Consultants",30,
IF(Role="Developers",26,
IF(Role="Engagement Managers",38,
IF(Role="Managers",28,
IF(Role="Project Managers",42,
IF(Role="Senior Sales Executives",26,0)))))))