Online Training On SharePoint
                      

Friday 1 May 2009

Accessing Server Variables in the Data View Web Part

We had a requirement where we need to show the Server Name and the Logged In user name through a Data View Web Part in a SharePoint Page.

For this purpose we can use ServerVariables in the Data View Web Part. We can create new parameters from Common Data View Task as shown in the screen shot:



Give a proper name to the Parameter and then specify which Server Variable we want to access with this. Once we do this this Server Variable will be assigned to this parameter. In my case I have created two variables with SERVER_NAME and LOGON_USER

Once this is done these variable can accessed from XSLT using the code:
<xsl:value-of select="$ServerName"></xsl:value-of>

All the Server Variables list which we can use are found here:

2 comments:

Preet said...

Nice post thanks for posting but can you tell me how to add this server varibale in sharepoint list.

Preet said...

Hello Manish,

Excellent post can you tell me how to add server variables in sharePoint list.

Thanks,

Related Posts with Thumbnails