[CLOSED] [Razor] Using Model in MVC View

  1. #1

    [CLOSED] [Razor] Using Model in MVC View

    Hello,

    Could you give me an example for using Model in MVC View
    I had tried:

    @Html.X().Label().Text(@<text>@Model.Pageheading</text>)
    But this doesn't work


    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type
    Last edited by Daniil; May 02, 2012 at 4:45 PM. Reason: [CLOSED]
  2. #2
    I guess it should be
    @Html.X().Label().Text(Model.Pageheading)
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Hi,

    I think it should look just
    @Html.X().Label().Text(Model.Pageheading)
    Here is an example.

    Example View
    @inherits System.Web.Mvc.WebViewPage<DateTime>
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <title>Ext.NET Razor Example</title>    
    </head>
    <body>    
        @Html.X().ResourceManager()
    
        @(Html.X().Label()
            .Text("The current time is " + Model.ToShortTimeString())
        )
    </body>
    </html>
    Example Controller Action
    public ActionResult TestRazor()
    {
        return View(DateTime.Now);
    }
  4. #4
    Thank you, it works now

Similar Threads

  1. [CLOSED] [Razor] Select Combobox item from model value
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Aug 09, 2014, 5:28 AM
  2. [CLOSED] [MVC-Razor] How to pass Model to Ext PartialView
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 01, 2012, 8:17 AM
  3. Using model var in mvc view
    By sinai.doron in forum 1.x Help
    Replies: 1
    Last Post: Nov 09, 2011, 5:19 PM
  4. [CLOSED] EXT.NET and ASP.NET MVC View Model
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 18, 2011, 6:04 PM
  5. [CLOSED] Null view model with PartialViewRenderer
    By paulc in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 17, 2011, 7:30 AM

Tags for this Thread

Posting Permissions