VB.NET
Hello
I do my develpment in VB.NET. When I open a Sitefinity 4 project using the Project Manager in Visual Studio 2010 it does not give me a choice to use a VB.NET version. Is there a template somewhere I am missing.
Thanks.
John
Hi John Stewart,
Thank you for using our services.
Indeed the Sitefinity web application is a C# project. We intend on providing Visual Studio templates for creating controls and modules in different languages. Currently what you can do is to create code libraries in VB and build your custom controls into assemblies. Then you will be able to reference those assemblies in your Sitefinity web application.
Sincerely yours,
Radoslav Georgiev
the Telerik team
Thanks Radoslav.
I am developing some custom controls in VB.NET. I have created a Visual Studio 4 VB.NET project and am creating a collection of usercontrols that do not need to interact with Sitefinity's libraries.
When I am in the Visual Studio project I use Add New Item, select Web Usercontrol, and start from there. When I am finished and want to use that control in Sitefinity I change the following information in the .ascx file
CodeBehind="UserControlName.ascx.vb" to CodeFile="UserControlName.ascx.vb"
AND
Inherits="VisualStudioProjectName.UserControlName" to Inherits="UserControlName"
After this I load the .ascx and .vb file into a designated folder in the Sitefinity project, add the control to the toolbox, and all sees to work alright.
My concern is that just because it works doesn't mean I am doing this correctly. The changing of the .ascx header leaves me feeling like I am doing something wrong.
Can you comment as to whether my approach is correct.
Thanks.
Hello John,
We ship our application as a C# project. You can create a separate class library in VB, or create your vb user controls in visual basic project and then just paste them in Sitefinity project.
Another option is converting Sitefinity 4.0 BETA2 to website instead of running it as a web application( which is the default stage).
Kind regards,
Ivan Dimitrov
the Telerik team
I am trying to run through the tutorial in from Sitefinity 4 Beta 2 PDF 'How to Create A Widget' and am trying to do so using VB.NET.
Running the following C# code through your converter
RadRotator1.DataSource = App.WorkWith().NewsItems().Where(n => n.Status == ContentLifecycleStatus.Live).Get().Take(
this
.NewsLimit).ToList() .Join(App.WorkWith().Images().Get().Where(i => i.Parent.Title ==
"Thumbnails"
&& i.Status == ContentLifecycleStatus.Live), item => item.Title.Value, image => image.Title.Value, (item, image) =>
new
NewsItem = item, NewsImage = image ); RadRotator1.ItemDataBound +=
new
RadRotatorEventHandler(RadRotator1_ItemDataBound); RadRotator1.DataBind();
RadRotator1.DataSource = App.WorkWith().NewsItems().Where(
Function
(n) n.Status = ContentLifecycleStatus.Live).[
Get
]().Take(
Me
.NewsLimit).ToList().Join(App.WorkWith().Images().[
Get
]().Where(
Function
(i) i.Parent.Title =
"Thumbnails"
AndAlso
i.Status = ContentLifecycleStatus.Live),
Function
(item) item.Title.Value,
Function
(image) image.Title.Value,
Function
(item, image)
New
With
_
.NewsItem = item, _
.NewsImage = image _
)
Error 3 Overload resolution failed because no accessible 'Where' can be called with these arguments:
'Public Overridable Function Where(expression As String, ParamArray values() As Object) As Telerik.Sitefinity.Fluent.ContentFluentApi.NewsPluralFacade(Of Telerik.Sitefinity.Fluent.ContentFluentApi.BaseFacade)': Lambda expression cannot be converted to 'String' because 'String' is not a delegate type.
'Public Overridable Function Where(what As System.Linq.Expressions.Expression(Of System.Func(Of Telerik.Sitefinity.News.Model.NewsItem, Boolean))) As Telerik.Sitefinity.Fluent.ContentFluentApi.NewsPluralFacade(Of Telerik.Sitefinity.Fluent.ContentFluentApi.BaseFacade)': 'ContentLifecycleStatus' is not declared. It may be inaccessible due to its protection level.
Error 5 'Where' is not a member of 'System.Linq.IQueryable(Of Telerik.Sitefinity.Libraries.Model.Image)'.
Hello John S.,
You should use image.Parent.Title.Value. The Title property is of type Lstring and its seems that VB cannot implicitly convert this type to string. Bellow is sample:
Imports
System.Data
Imports
System.Linq
Imports
System.Web.Query.Dynamic
Imports
System.Web.UI.WebControls.Expressions
Imports
Telerik.Sitefinity
Imports
Telerik.Sitefinity.Data.Linq.Dynamic
Imports
Telerik.Sitefinity.GenericContent.Model
Imports
Telerik.Web.Data.Extensions
Imports
Telerik.Web.UI
Public
Class
Class1
Dim
NewsLimit
As
Integer
= 25
Public
Sub
c()
Dim
RadRotator1
As
RadRotator =
New
RadRotator()
RadRotator1.DataSource = App.WorkWith().NewsItems().Where( _
Function
(n) n.Status = GenericContent.Model.ContentLifecycleStatus.Live).
Get
().Take(
Me
.NewsLimit).ToList().Join(App.WorkWith().Images().Where(
Function
(i) i.Parent.Title.Value =
"Thumbnails"
AndAlso
i.Status = ContentLifecycleStatus.Live).
Get
().ToList(),
Function
(item) item.Title.Value,
Function
(image) image.Title.Value,
Function
(item, image)
New
With
_
.NewsItem = item, _
.NewsImage = image _
)
End
Sub
End
Class
Hi there,
You should be able to create a VB project and then add the files needed in the project and then add references to SF?
Then create the files you want in vb:)
/Thanks