哪里是为SharePoint aspx页面的code-背后? [英] Where's the code-behind for sharepoint aspx pages?

查看:96
本文介绍了哪里是为SharePoint aspx页面的code-背后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

毫无疑问,我失去了一些东西很明显这里 - 但我是新到SharePoint所以请多多包涵。

No doubt I'm missing something very obvious here - but I'm new to sharepoint so please bear with me.

我已经成功地将母版页,创建内容类型和已经创建了一个aspx页面为我的自定义内容类型 - 但我无法找到它的CS文件

I've successfully added a master page, created a content type and have created an aspx page for my custom content type - but I can't find its cs file!?

有没有在code-背后是SharePoint解决方案实现的另一种方式?这似乎在创建控件时是相似的。我已经习惯了标准的ASP.NET C#Web应用程序开发中所有的aspx页面的来与code-隐藏文件为标准。

Is there another way in which code-behind is implemented in sharepoint solutions? It seems to be similar when creating controls. I'm used to standard asp .net c# web application development were all of the aspx pages come with the code-behind files 'as standard.'

感谢。

推荐答案

在SharePoint中,你可以有一个code-behind类,但它需要在装配中,而不是在一个aspx.cs code-隐藏文件。

In SharePoint, you can have a code-behind class, but it needs to be in an assembly, not in an aspx.cs code-behind file.

使用Visual Studio 2010,为你的aspx页面Page指令看起来像这样:

Using Visual Studio 2010, the Page directive for your aspx page would look something like this:

<%@ Page 
    Language="C#" 
    DynamicMasterPageFile="~masterurl/default.master" 
    Inherits="MyNamspace.MyPage, $SharePoint.Project.AssemblyFullName$"
    %>

您可以再创建一个 MyNamspace.MyPage 类,并尽一切你在一个常规的code-隐藏文件做的。

You can then create a MyNamspace.MyPage class and do everything you would do in a regular code-behind file.

如果你看看在列于14蜂巢\\ TEMPLATE \\ LAYOUTS目录框ASPX页面中,你会看到,而有些网页上有内嵌code(这是允许的布局),几乎每一页从类继承中的SharePoint组件之一。

If you take a look at the out of the box aspx pages in the 14 hive\TEMPLATE\LAYOUTS directory, you will see, while some pages have inline code (which is allowed in layouts), almost every page inherits from a class in one of the SharePoint assemblies.

这篇关于哪里是为SharePoint aspx页面的code-背后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆