使用 Visual Studio 2010 在 Sharepoint 2010 中进行条件格式设置

发布于 2024-09-30 05:49:47 字数 1416 浏览 4 评论 0原文

我想做的是:

我目前正在部署大量列表和代码隐藏。但是,我还想部署的是包的“视觉方面”。但是,目前,这是使用 Sharepoint Designer 2010 完成的。

我的猜测是,我在 Sharepoint Designer 2010 中所做的所有修改都可以在 Visual Studio 2010 中以一种或另一种方式完成,使用视图的 Schema.xml 或代码隐藏。我其实也不介意。

但我无法进行任何静态 XSL 转换。我的 XSL 文件将基于最近添加的动态列,我想从这样的内容开始。

<xsl:include href="/_layouts/xsl/main.xsl"/>
<xsl:include href="/_layouts/xsl/internal.xsl"/>
<xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]"/>
<xsl:param name="dvt_apos">&apos;</xsl:param>
<xsl:template name="FieldRef_User_body.Employee" ddwrt:dvt_mode="body" match="FieldRef[@Name='Employee']" mode="User_body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
  <xsl:param name="thisNode" select="."/>
  <span>
    <xsl:attribute name="style">
      <xsl:if test="normalize-space($thisNode/@Employee) = 'Mats-PC\Mats'" ddwrt:cf_explicit="1">background-color: #DEF0FA;</xsl:if>
    </xsl:attribute>
    <xsl:value-of disable-output-escaping="yes" select="$thisNode/@*[name()=current()/@Name]" />
  </span>
</xsl:template>

解释一下,当 Employee 值(用户类型)等于“Mats-PC\Mats”时,这会将背景颜色设置为其他颜色。

我该如何使其动态化,并将其添加到该视图中?我查看了 SPView 对象,我看到的只是 Xsl 和 XslLink,但我不知道如何处理它们。有什么想法吗?

问候,

垫子

What I would like to do is the following:

I'm currently deploying a huge collection of lists and codebehind. But, what I also want to deploy is the 'visual side' of the package. But, currently, this is done using Sharepoint Designer 2010.

My guess is that all the modifications I do in Sharepoint Designer 2010 can be done in one way or another in Visual Studio 2010, using either the Schema.xml of the view, or codebehind. I don't really mind either.

I can't have any static XSL transforming though. My XSL file will be based on the recently added dynamic columns, and I want to start with something like this.

<xsl:include href="/_layouts/xsl/main.xsl"/>
<xsl:include href="/_layouts/xsl/internal.xsl"/>
<xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() >= $FirstRow and position() <= $LastRow)]"/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:template name="FieldRef_User_body.Employee" ddwrt:dvt_mode="body" match="FieldRef[@Name='Employee']" mode="User_body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
  <xsl:param name="thisNode" select="."/>
  <span>
    <xsl:attribute name="style">
      <xsl:if test="normalize-space($thisNode/@Employee) = 'Mats-PC\Mats'" ddwrt:cf_explicit="1">background-color: #DEF0FA;</xsl:if>
    </xsl:attribute>
    <xsl:value-of disable-output-escaping="yes" select="$thisNode/@*[name()=current()/@Name]" />
  </span>
</xsl:template>

To explain, this will set the background colour to something else when the Employee value (Of type User) is equal to 'Mats-PC\Mats'

How would I go and make this dynamic, and add this to that one view? I've looked in the SPView object, and all I see is Xsl and XslLink, but I have no clue what to do with them. Any ideas?

Greetings,

Mats

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世界和平 2024-10-07 05:49:47

获取 SharePoint Manager 的副本以查看 SharePoint 实例中对象的值。 Xsl 属性通常用于存储将用于呈现视图的 Xsl,但如果在 XslLink 中提供了 url,则会覆盖并从那里提取 Xsl。由于 SharePoint 安全性,您可能会遇到 xsl 某些包含的问题。

Grab a copy of SharePoint Manager to get a look at the values of objects in a SharePoint instance. The properties Xsl is usually used to store the Xsl that will be used to render the view, but if a url is provided in XslLink, that will override and pull out the Xsl from there. You may have trouble with xsl some includes because of SharePoint security.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文