Using @ViewBag in Title of MobileView

3 posts, 0 answers
  1. Mike
    Mike avatar
    4 posts
    Member since:
    Apr 2015

    Posted 03 Jun Link to this post

    This isn't really specific to MobileView but I'm using a MobileView in a partial view that I'm using as a layout template and I want to make the Title dynamic by using ViewBag.Title as the string.

                    .Header(obj => Html.Kendo().MobileNavBar().Content(navbar =>
                            @navbar.ViewTitle("Hello there")
                    .HtmlAttributes(new { style = "height: 46px;" })


    But this isn't valid. I've also tried @ViewBag.Title and various other incarnations. I'm wondering if this type of thing is possible in the Title of the MVC controls. 

  2. Ianko
    Ianko avatar
    1507 posts

    Posted 07 Jun Link to this post

    Hi Mike,

    You can try assigning the ViewBag.Title value to a string variable first and then assign this variable to the Title method. 

        string title = ViewBag.Title;

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
  4. Mike
    Mike avatar
    4 posts
    Member since:
    Apr 2015

    Posted 07 Jun in reply to Ianko Link to this post

    Awesome! Pretty simple and works (of course). Thanks very much. 
Back to Top