We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Getting started with VB.Net?

Thread ID:





96776 Oct 5,2010 08:55 AM Oct 8,2010 01:28 AM ASP.NET Web Forms (Classic) 3
Tags: GridGroupingControl
Greg Clouston
Asked On October 5, 2010 08:55 AM

Any examples of basic getting started code in VB.Net? I can translate C# code for the controllers to VB.Net via one of the many translators out there. The view code is another thing all together.


Greg Clouston
Replied On October 5, 2010 09:13 AM

Here's the code I'm trying to translate:

.Column( column => {
column.Add(c => c.OrderID).HeaderText("Order ID");
column.Add(c => c.CustomerID).HeaderText("Customer ID");
column.Add(c => c.EmployeeID).HeaderText("Employee ID");
column.Add(c => c.OrderDate).HeaderText("Order Date").Format("{OrderDate:dd/mm/yyyy}");
column.Add(c => c.Freight).HeaderText("Freight");

Greg Clouston
Replied On October 5, 2010 01:58 PM

I've managed to make some head way. I ended up translating the code into this:

<%= Html.Grid(Of MvcSampleApplication.Order)("FlatGrid") _
.Datasource(Model) _
.EnablePaging() _
.EnableSorting() _
.Column(Function(columns) {
columns.Add(Function(c) c.OrderID).HeaderText("Order ID"),
columns.Add(Function(c) c.CustomerID).HeaderText("Customer ID"),
columns.Add(Function(c) c.EmployeeID).HeaderText("Employee ID"),
columns.Add(Function(c) c.OrderDate).HeaderText("Order Date").Format("{OrderDate:dd/mm/yyyy}"),
columns.Add(Function(c) c.Freight).HeaderText("Freight")})

Now I've got something grid-like being displayed but it is far from what the example looks like. See attached image. Is this a control registration issue?

SyncFusion support 01_8c0144cc.rar

Krishnaraj D [Syncfusion]
Replied On October 8, 2010 01:28 AM

Hi Greg Clouston,

Thanks for your interest in Syncfusion Products.

Please refer the below view code snippets for Grid in VB.

<% 'Define the grid and enable the require features like paging and sorting
Dim gridbuilder = Html.Grid(Of MvcApplication3.employee)("Grid1").Datasource(Model).EnablePaging().EnableSorting()

'add grid columns using gridbuilder
gridbuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As MvcApplication3.employee) c.emp_id).HeaderText("Employee ID"))
gridbuilder.Column(Function(cols) cols.Add(Of String)(Function(c As MvcApplication3.employee) c.fname).HeaderText("Employee Name"))
gridbuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As MvcApplication3.employee) c.job_id).HeaderText("Job Id"))
gridbuilder.Column(Function(cols) cols.Add(Of Date)(Function(c As MvcApplication3.employee) c.hire_date).HeaderText("Hire Date"))

'Render the grid by using Render()

Refer the below code snippets for controller.

Function Index() As ActionResult
Dim northwind As PUBSEntities3 = New PUBSEntities3

Return View(northwind.employees)
Return View()
End Function

Function Index(ByVal args As PagingParams) As ActionResult

Dim northwind As PUBSEntities3 = New PUBSEntities3

Dim data As IEnumerable = Nothing
data = northwind.employees
Return data.GridActions(Of employee)()
End Function

Please let us know if you have any queries.

Krishnaraj D


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.