Setting DisplayFormURL of a CalendarView control SPCalendarView

Background:

I have a WebPart that uses the SPCalendarView control, and in it I dynamically add items (events) from different calendar lists from multiple sites.

Problem:

I need to also display DisplayFormUrl dynamically:

Currently setting up:

DisplayFormUrl = string.Format("/Lists/{0}/DispForm.aspx", LstName) 

will use the WebPart website URL instead of the actual list URL. I want to be able to:

 DisplayFormUrl = string.Format("{0}/Lists/{1}/DispForm.aspx", SiteURL,LstName) 

Any ideas on how I can achieve this (if I can)?

When I compile it, DisplayFormUrl automatically adds the parent website (which is in the web part) to the URL, can I still change it?

Someone please help ...

+4
source share
1 answer

if I understand you correctly, you will want to use the SPContext class

class spcontext

you can use it as

 SPList oListCur = SPContext.Current.List; SPWeb oWeb = SPContext.Current.Web; SPSite oSite = SPContext.Current.Site; 
0
source

Source: https://habr.com/ru/post/1403747/


All Articles