.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Handling page redirection in SharePoint Sandboxed solutions

Posted By:Kaviya Balasubramanian       Posted Date: December 17, 2013    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article, I'll explain a way to handle page navigation from code behind using Literal control in Sandboxed solution.

There are some restrictions in using Page.Response.Redirect to navigate pages in SharePoint sandboxed solutions. If you want to handle page navigation from Code behind, you can make use of the literal control that invokes the script for page navigation.

Here is how it works

Step 1

In the SharePoint sandboxed web part add a Literal control and name it as your wish like the one shown below:

asp:Literal ID="litRedirect" runat="server" />

Step 2

Now on your web part's code behind, you can assign the script as text of the literal control. Here is the code segment that assigns the script as text to Literal control:

 redirectURL = string.Format("{0}/{1}"SPContext.Current.Web.Url,"SitePages/PageName.aspx");
litRedirect.Text = 
"<script type='text/javascript'>window.location = '" + redirectURL + "/';</script>";


That's all, you're done. As soon as you assign the script to literal control in your code behind, you will be navigated to the page that you specified.


In this article we have seen a way to handle page navigation in SharePoint sandboxed solution. Stay tuned for more articles.

For more articles Visit: SharePoint Contriver

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend