0

When I am adding any application page(.aspx) to my Module in the Visual Studio Project of SandBox Solution, it is always adding that page in Layouts(Mapped) folder. And not adding that page in the Module.

That's why I am not able to open my page using JavaScript. Because it wants the Layout reference. And If Layout folder is their, then I am not able to create the Package or not able to deploy directly.

So How can I add .aspx page to Module in SandBox Solution ?

2 Answers 2

1

You cannot directly add a .aspx page through visual studio. You will have to use a workaround for that. Its basically creating a Module, changing the name of the sample.txt file to the desired .aspx file. And then pasting the markup inside the new file.

Please see this link for more details:

http://www.wictorwilen.se/Post/Custom-application-pages-in-the-SharePoint-2010-Sandbox.aspx

1
  • I am able to display the webpart or some text using above mehtod, but I want to create some dynamic controls and have multiple lines of code in Code behind file. So using this I am not able to do this. So how can I do this ?
    – Shahid
    Mar 14, 2013 at 6:34
1

What's good to do is, deploy your .aspx page within the module, define zones int he .aspx page, and create your logic and code into webparts, and in the module's definition, insert the webparts into the desired zones.

See this example: http://amalhashim.wordpress.com/2013/02/14/sharepoint-deploy-webpart-page-using-module/

Do as mentioned in the article, but ignore the .cs file, just insert a webpart zone in your .aspx file, and in the module connect the webpart to the page.

You can use only webpart project item, you won't be able to use the visual webpart, here is an extension for VS that will enable you to create visual webpart in Sandbox:

http://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.