Conditional Formatting within Sharepoint 2010 using Visual Studio 2010
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() &开发者_开发知识库;gt;= $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
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.
精彩评论