Display the users IP Address in a Data View Web Part

  1. Open up an existing DVWP or create one.
  2. Right click the DVWP and select ‘Common Data View Tasks’ (or click the little arrow that appears on the top right of the DVWP)
  3. Click the ‘Parameters’ link
  4. In the dialog that opens up click the ‘New Parameter’ button.
  5. Provide a name for the parameter (e.g. IPAddress)
  6. In the ‘Parameter Source’ dropdown select ‘Server Variable’
  7. In the ‘Server Variable Name’ text box enter REMOTE_ADDR
  8. Leave the ‘Default Value’ text box empty
  9. Click OK
  10. Now switch to the code view and go to the place where you want the IPAddress to appear and type the following:
<xsl:value-of select="$IPAddress" />

Here’s a list of server variables:





Passing parameter to a function for onclick in an XSLT RSS


I have a link in a xslt file and some javascript methods in another file. When I click on the link, the javascript method invokes. I need to pass in a xsl value to the js method. OK, this sounds really confusing. Here is some code:

In the xsl file:

<a href=”#” onclick=”javascript:portal_openDispCalModalDialog(‘@xslparameter’)”>

<xsl:value-of select=”@Title” />


In the js file:

function portal_openDispCalModalDialog(id){

var options = {url:”list/DispForm.aspx?ID=”+id+”&IsDlg=1“,

dialogReturnValueCallback: CalDialogCallback


SP.UI.ModalDialog.showModalDialog(options);     }


I needed to build my onclick as an attribute and then add the data inside it.

<a href=”#”>
<xsl:attribute name=”onclick”>
javascript:portal_openDispCalModalDialog(‘<xsl:value-of select=”@ID”/>’)
<xsl:value-of select=”@Title” />





SharePoint calculated column and data view web part issue


I have a list with a column called newsID. newsID is a calculated column based on created date. I set the column as a number type and leave the decimal places to be automatic.

This list also have another calculated column called newsLink. newsLink is calculated based on newsID.

I have a Data View Web Part to display a item from this list. The DVWP has a parameter and filters based on the newsID column.

Once all of these are setup, open the DVWP in browser. Copy one of the list item’s newsID value to the end of that page’s URL.  The item should display fine in the DVWP page.

Edit that item in the list. Refresh the DVWP page. Oops! You see the message “There are no items to show in this view.”



Change the newsID column to have this formula:


Select data type to be Single line of text.

Issue should be fixed.