Question

Is there a way in the server side .NET code of a custom built web part to detect and use the properties of the page the web part will be deployed on.

So page library has custom column (property) "x" In web part want to use the value of column "x" i.e. "if x = 2 then...."

or failing that is there a way to detect the name of the page in the server side code of the web part so that I can use CAML to query the page library and get the SPListItem for that page and get the properties that way.

I know I can add a custom web part property to the tool pane and have the user just input the name of the page but I'd rather save my users having to do that.

Was it helpful?

Solution

Below snippet can give you the current URL

System.Web.HttpContext.Current.Request.Url
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top