Archive

Archive for February, 2011

Content Query Web Part Custom column not available in Sort By

February 28, 2011 Leave a comment

In one of my SharePoint 2010 project, I have multiple lists which are of custom content type.

I am using  CQWP in one of my web part page to query data with custom content type and I want that result to be in sorted order using one of the custom column value.

When setting the properties of Content Query Web Part I was not able to select my custom column in the Sort By drop down box as it is not listed there. After googling I found that I could override the query by exporting the web part and adding my CAML query to override the query using ‘QueryOverride’ property of the web part. But found that once you override the query all other filters which is set by GUI is removed so we need to include all other columns in CAML query , which is tedious for me as for only one custom column I need to rewrite the whole CAML query.

After looking the issue with different angles and researching I found the issue,I used content query web part to query data using custom content type but I have added the columns in list.

To make it work I have removed the columns from list and added them to content type after this the custom columns are available in Sort By dropdown and my issue is resolved.

Hope this will help you also.

Advertisements

How to remove NAN values in XSLT

February 28, 2011 Leave a comment

NaN is a value  which is an illegal number (Not-a-Number).

So,How to remove NaN values from XSLT?

<xsl:if test="<your-variable> = 'NaN'">
	<xsl:text>your-text</xsl:text>
</xsl:if>
Categories: XSLT Tags: ,

Redirect to https:// from http in ASP.net

February 15, 2011 1 comment

Hi Friends,
In some cases if you want to redirect the request from Non-secured to secured page.
Add following code in your page or master page.

if(!Request.IsSecureConnection)
{
string redirectUrl = Request.Url.ToString().Replace("http:", "https:");
Response.Redirect(redirectUrl);
}

This will redirect to same page with HTTPS.

Categories: Asp.net Tags: , , ,