Accessing a Shared Content Item Via User Control (VB.NET)
So I'm not sure if this is a user problem or a bug, but I'm having a few problems getting this example: http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-modules-generic-content-querying-content-items.html to work.
I used a couple of C# to VB converts to just make sure it was converted fine, so this is my first version of the code:
Public
Function
FindGenericContent(
ByVal
contentItemTitle
As
String
,
ByVal
contentToSearch
As
String
)
As
ContentItem
Dim
manager
As
ContentManager = ContentManager.GetManager()
Dim
contentItem
As
ContentItem = manager.GetContent().Where(
Function
(t) t.Title = contentItemTitle).Where(
Function
(t) t.Status = ContentLifecycleStatus.Live).[
Single
]()
'.Where(Function(t) t.Content.Contains(contentToSearch))
Return
contentItem
End
Function
Public
Function
FindGenericContent(
ByVal
contentItemTitle
As
String
,
ByVal
contentToSearch
As
String
)
As
ContentItem
Dim
manager
As
ContentManager = ContentManager.GetManager()
Dim
contentItem
As
ContentItem = manager.GetContent().Where(
Function
(t) t.Title.Value = contentItemTitle).Where(
Function
(t) t.Status = ContentLifecycleStatus.Live).[
Single
]()
'.Where(Function(t) t.Content.Contains(contentToSearch))
Return
contentItem
End
Function
is anyone able to help with this?
Thanks
Regards
Byron Boardman
Hi Byzza,
We are having issues with visual basic and linq expressions. You can check here :
http://www.telerik.com/support/pits.aspx#/public/sitefinity/4981 .
Could you try to use something like this :
From c In ContentManager.GetManager() where c.Title == "Test";
My Linq is fairly non existant at the moment, so could you help me, what should I be replacing?
I tried both
changing this line:
Dim
contentItem
As
ContentItem = manager.GetContent.Where(
Function
(t) t.Title.Value = contentItemTitle).Where(
Function
(t) t.Status = ContentLifecycleStatus.Live).[
Single
]()
Dim
contentItem
As
ContentItem = From c
In
manager Where c.title = contentItemTitle
Dim
contentItem
As
ContentItem = manager.GetContent.Where(From c
In
manager Where c.title = contentItemTitle).where(
Function
(t) t.Status = ContentLifecycleStatus.Live).[single]()
Dim
manager
As
ContentManager = ContentManager.GetManager()
Hello Byzza,
At the moment we are having issues with visual basic and linq expressions. Here a PITS issue is logged :
http://www.telerik.com/support/pits.aspx#/public/sitefinity/4981 .
Will need more time to investigate and fix the problem with VB.
Sorry for inconvenience!