Get An XSL Filepath For WebParts

This method allows you to get an XSL File Path that you can use in your webparts. I find it useful if I am applying formatting to things that are generated out of the object model.

[csharp]

public string XslFilePath
{
        get
        {
                if (this.xslFilePath == “Example.xsl”)
                {
                        return new Uri(this.Page.Request.Url, this.Page.Request.Url.AbsolutePath + “?ControlResource=” + this.xslFilePath).ToString();
                }
                return new Uri(this.Page.Request.Url, this.xslFilePath).ToString();
        }
        set
        {
                if ((value == null) || (value.Trim() == string.Empty))
                {
                        throw new Exception(” The XSL File Path Is Not Valid.”);
                }
                this.xslFilePath = value;
        }
}

[/csharp]

Share

Leave a Reply

Your email address will not be published. Required fields are marked *