After a mammoth session learning (and subsequently patching) SiteFinity 4.2, the last hurdle I need to overcome is the ability to get the content of a List Item and assign it to an ASP (C#) variable.
Essentially I'd like to be able to loop over all given List Items (in this case, blog posts) and assign the content of the ListItem (Blog Post) to a C# variable which I can then manipulate.
Does anyone have any experience doing this? I've followed an old
(SF3.x, Visual Basic) how-to and managed (I think!) to translate it to SF4.2 and C#. The code appears below.
Unfortunately, I cannot get the code to load anything into the list. Visiting the page in a browser gives the following error (ASP gives Line 6, below, as the point of occurance):
I have a feeling I might need to use a Linq Query to extract the posts I want, however I'm not so sure how to go about it. Can anyone give me a pointer or helping hand please?
Exception Details: Telerik.Sitefinity.SitefinityExceptions.ItemNotFoundException: You are trying to access item that no longer exists. The most probable reason is that it has been deleted by another user.
[ItemNotFoundException: You are trying to access item that no longer exists. The most probable reason is that it has been deleted by another user.]
DynamicModule.ns.Wrapped_OpenAccessListsDataProvider_e1f3a1b538c2464d870ac9deb2d5665e.GetList(Guid id) +253
Telerik.Sitefinity.Modules.Lists.ListsManager.GetList(Guid id) +45
SitefinityWebApp.Controls.TestBlog.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\pp\Controls\TestBlog.aspx.cs:23
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
sender, EventArgs e)
/* Setup array to hold posts */
 strContent =
/* Define new list manager for access to lists */
Telerik.Sitefinity.Modules.Lists.ListsManager mgrList =
/* Define GUID of list to load */
Guid searchForGuid =
/* Load list into new SiteFinity list */
Telerik.Sitefinity.Lists.Model.List objLists = mgrList.GetList(searchForGuid);
/* Define a list item for use later */
Telerik.Sitefinity.Lists.Model.ListItem thisItem =
/* Load list into more system friendly model */
System.Collections.IList sysList = objLists.ListItems.ToList();
/* Loop over system friendly list and write content to array */
c = 0;
/* Assign content to array */
/* Output something to the screen */
+ c.ToString() +