Link to home
Start Free TrialLog in
Avatar of maqskywalker
maqskywalker

asked on

asp.net webgrid helper C# razor syntax

Hi experts,


I have asp.net mvc application, using VB and razor syntax.
My application works just fine.

Now i'm trying to convert this app into asp.net mvc application, using C# and razor.

I have a partial view in my VB application that looks like this. It works just fine.

Visual Basic webgrid

<div id="grid">

@grid.GetHtml(tableStyle:="table-condensed", _
                   headerStyle:="webgrid-header", _
                   footerStyle:="webgrid-footer", _
                   columns:=grid.Columns( _
                                        grid.Column("EmployeeID", "EmployeeID", format:=Function(str) Html.ActionLink(CType(str, System.Web.Helpers.WebGridRow).Value.employeeID, "Edit", "Form" & CType(str, System.Web.Helpers.WebGridRow).Value.EmployeeType, New With {.RegionNo = CType(str, System.Web.Helpers.WebGridRow).Value.DistrictNo, .RefNo = CType(str, System.Web.Helpers.WebGridRow).Value.EmployeeID}, New With {.class = "ActionLink"})), _
                                        grid.Column("FirstName", "First Name"), _
                                        grid.Column("LastName", "Last Name")
)
            )

</div>

Open in new window


I'm trying to translate this snippet into C# but I'm having trouble. The specific line i'm having trouble with is the first grid.column which looks like this:

grid.Column("EmployeeID", "EmployeeID", format:=Function(str) Html.ActionLink(CType(str, System.Web.Helpers.WebGridRow).Value.employeeID, "Edit", "Form" & CType(str, System.Web.Helpers.WebGridRow).Value.EmployeeType, New With {.RegionNo = CType(str, System.Web.Helpers.WebGridRow).Value.DistrictNo, .RefNo = CType(str, System.Web.Helpers.WebGridRow).Value.EmployeeID}, New With {.class = "ActionLink"})), _

Anyone know how I write this line in C# ?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial