1

I just started learning Ext.net MVC and i m using Razor engine. i found out there is two different and equivalen syntaxes used in the .cshtml files. For example, in order to create a grid panel, we can use:

Syntax #1:

@(Html.X().GridPanel().Title("Grid"))

Or Syntax #2:

Ext.Net.GridPanel grid = new Ext.Net.GridPanel();
 grid.Title = "Grid";

Whats's the name of each syntax? is there any way to translate the first code to the second one?

1 Answer 1

1

They are both c#. However, syntax #1 invokes a html helper using a fluent builder to configure the grid. Syntax 2 is plain old C#, you just set up properties. Both are alternative ways to set up the GridPanel, only that in the first case the helper also renders the control (generates the html). You don't need to translate anything. You can say syntax 1 is the way to easily integrate the GridPanel code into a razor view.

Sign up to request clarification or add additional context in comments.

1 Comment

Is there any documentation or software to translate the html helper code to to C# code? In my project i want to use the c# code but most of the solutions on the net are writen in html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.