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. Image for the cookie policy date

Card view demo?

Are there any VB.Net examples for this sample?

I'm having a hard time translating part of the view. I can add the first column fine but I'm having trouble creating a template based column.

http://samples.syncfusion.com/sfmvcsamplebrowser/8.3.0.21/MVC/Grid_MVC/Samples/4.0/productshowcase/CardView


1 Reply

KD Krishnaraj D Syncfusion Team October 27, 2010 02:03 PM UTC


Hi Greg Clouston,

Thanks for your interest in Syncfusion Products.

Please refer the below code snippets for cardview demo in VB.

CardView.ascx:

<% 'Define the grid and enable the require features like paging and sorting
Dim gridbuilder = Html.Grid(Of MvcApplication3.employee)("Grid1").Datasource(Model).EnablePaging().EnableSorting().ShowCaption(False)
gridbuilder.ShowRowHeader(False).AllowDragAndDrop(False)
gridbuilder.AllowSelection(False).EnableScrolling()
gridbuilder.AllowResizing(False)
gridbuilder.Scrolling(Function(scroll) scroll.Height(394).Width(700))
gridbuilder.QueryCellInfo(Function(cell)
If cell.TableCellType = GridTableCellType.AlternateRecordFieldCell OrElse cell.TableCellType = GridTableCellType.RecordFieldCell Then
If cell.Column.MappingName = "photo" Then
cell.Text = " + cell.Data.fname + "
End If
If cell.Column.MappingName = "CardViewTemplate" Then
cell.Text = Html.[Partial]("DisplayTemplates/CardViewTemplate", cell.Data)
End If

End If
End Function)


'add grid columns us ing gridbuilder
gridbuilder.Column(Function(cols) cols.Add("photo").HeaderText("Photo"))
gridbuilder.Column(Function(cols) cols.Add("CardViewTemplate").HeaderText("Employee Details"))

'Render the grid by using Render()
gridbuilder.Render()

%>

CardViewtemplate.ascx:

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of MvcApplication3.employee)" %>





















First Name

:
<% Html.Label(Model.fname)%>

Last Name

:
<% Html.Label(Model.lname)%>

Job ID

:
<%= Html.Label(Model.job_id)%>

Employee ID

:
<%= Html.Label(Model.emp_id)%>

Hire Date

:
<%= Html.Label(Model.hire_date.ToString())%>



Please let us know if you have any queries.

Regards,
Krishnaraj D




Loader.
Live Chat Icon For mobile
Up arrow icon