Redirecting to another page from JavaScript.showModalDialog window

Hope you all had a wonderful christmas celebration,so this is my first post after christmas where I had a good two weekend days.

Redirecting to another page from JavaScript Modal window without closing the window will not work if use the following client side code ,it always opens a new modeless window where the page will be displayed.

Window.location = url
document.location = url
top.location.href= url

so what we do and how we get a page redirected within the same window instance ,okay here we go.

Consider you have a page called Main.aspx where you have hyper link or a button which you want open a page called ‘OpenmeinModal.aspx” where from inside the ‘OpenmeinModal.aspx” you want to redirect to a new page called ‘redirectmewithinsamewindow.aspx”. You achieve this using the below sample code all you need to do is create a frameset.



Merry Christmas

So the day has finally arrived for this year ,I am talking about the christmas celebration and its the time to party now. I had plenty over this week and I wish each one a very happy merry christmas.

SharePoint 2010 : Hide Ribbon,Site Actions,Left Navigation,Bread Crumb easily using CSS

I had always request from my customers during SharePoint branding and customization to hide Ribbon,Site Actions,Left Navigation,Bread Crumb in a single or more than one page. The easy way to do so is please add a content editor webpart and edit the content in html source mode and copy and paste the below CSS classes. phew just in a matter of time you have done it without much hassle.

#s4-ribbonrow { display:none } –> top ribbon

#s4-leftpanel { display:none } –> left navigation

.s4-ca { margin-left:0px;background:transaparent} –> to keep the margin starting from the left or else you will find a blank space if you use only the above class

.s4-breadcrumb-top { display : none } –> breadcrumb

#s4-titlerow { display:none } –> top bar

Enjoy SharePoint Programming

Adding SharePoint Notification after any operation

I love the way SharePoint 2010 notification works and when I say the first time I really thought this going to be one of the cool foundings from MS. Guys please don’t forget to include this feature in your SharePoint apps,so are your geared up then implement using the below sample code.

var strNotificationID, strBlogNotificationID;

function showNofication()
strNotificationID = SP.UI.Notify.addNotification(“Message : Server is down for maintenance “, false);
strBlogNotificationID = SP.UI.Notify.addNotification(“Udai @ :Welcome to My World. “, true);

function removeNofication()
if ( strBlogNotificationID != null)
SP.UI.Notify.removeNotification( strBlogNotificationID;

The message can be built using html element as well ,to provide a better look and feel

Happy SharePoint 2010 Programming

Refresh the Parent Browser window from SharePoint 2010 Modal Dialog

If you want to refresh the parent browser window from the SharePoint Dialog box ,please use the below code

function OpenChangePasswordDialog(url, title, wdth, hght)


                                                var options = {

                         url: url,

                         title: title,

                         allowMaximize: false,

                        showClose: true,

                        width: wdth,

                         height: hght,

                        dialogReturnValueCallback: CloseWindowCallback



                    return false;


function CloseWindowCallback(dialogResult, returnValue)


         if(dialogResult == SP.UI.DialogResult.OK)



this.statusId = SP.UI
            .addStatus(“Password Changed”,
               “Your password has been changed. Use it next time when you log in.”,

        SP.UI.Status.setStatusPriColor(this.statusId, “Green”);