Background:
I have a WebPart that makes use of the SPCalendarView control and in it I add items (events) dynamically from different Calendar lists from multiple sites.
Problem:
I need to be able to see the DisplayFormUrl dynamically as well:
Currently setting :
DisplayFormUrl = string.Format("/Lists/{0}/DispForm.aspx", LstName)
will use the WebPart's website URL instead of the actual list's url. What I want to be able to do is:
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 web (that the webpart is in) to the URL is there anyway I can change that?
if I'm understanding you correctly you'll want to use the SPContext class
you can use it like
SPList oListCur = SPContext.Current.List;
SPWeb oWeb = SPContext.Current.Web;
SPSite oSite = SPContext.Current.Site;