开发者

Having codebehind for Custom .aspx page in sandbox solution

开发者 https://www.devze.com 2023-04-10 20:56 出处:网络
I am having working with sandbox solution. i have one .aspx page in my solution and i have placed one button tag in that page, i need to write server side code for that button. But it is showing \"The

I am having working with sandbox solution. i have one .aspx page in my solution and i have placed one button tag in that page, i need to write server side code for that button. But it is showing "The event handler 'OnClick' is not allowed in this page." . Does codebehind is not allowed in sandbox solution. Or indirectly how can i write my c# 开发者_JAVA技巧code for that button.

I know we can do it by creating one webpart and show that webpart in page using "WebPartPages:SPUserCodeWebPart" tag . But i want to confirm whether we can write codebehind for an asp page in some way or not.


Without changing the web.config file (which would not be recommended in this case), inline code or code behind files are not supported outside of the layouts folder (which you cannot deploy to with a sandbox solution).

However, you should be able to create a class and then set the inherits attribute to point to that class, instead of referring to the class in a code behind file.

0

精彩评论

暂无评论...
验证码 换一张
取 消