This is a migrated thread and some comments may be shown as answers.

[Solved] Cannot get TabStrip to work with Razor view

4 Answers 119 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stacy
Top achievements
Rank 1
Stacy asked on 14 Mar 2012, 06:51 PM
I cannot get the simple tabstrip example to work in my razor view. I continue to get errors and do not know how to get past them.In the end I need other partial views to be contained in each tab of the TabStrip. I am now just trying to get the TabStrip to do anything and so I removed all Content and still cannot get it to work! Please help. As a last resort i added the ScriptRegistrar at the end of the form, but with or without this I still get the same error.
HttpcompileException error CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

I have ripped out everything except for the tabstrip in my partial view, here is the contents of my view:
@using Telerik.Web.Mvc.UI
@model FileSelect.ViewModels.MyModel

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>



@using (Html.BeginForm("Edit", "Segment", FormMethod.Post, new { @class = "EditForm", id = "EditSegmentDetailsForm" }))
{
     <p>
        <button class="t-button t-button-icontext" type="button"><span class="t-icon t-update"></span>Save</button>
    </p>
    
    @Html.ValidationSummary(false)




       @(Html.Telerik().TabStrip()
        .Name("TabStrip")
        .Items(tabstrip =>
        {
            tabstrip.Add()
                .Text("ASP.NET MVC");

            tabstrip.Add()
                .Text("Silverlight");
        })
        .SelectedIndex(0)
        .Render()
    )



}

@(Html.Telerik().ScriptRegistrar()
    .DefaultGroup(group => group
                .Add("telerik.common.js")
                .Add("telerik.tabstrip.min.js"))
    .jQuery(false))

4 Answers, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 16 Mar 2012, 10:44 AM
Hello Stacy,

When using Razor view engine you should not call the Render method in combination with the @() operator, you should use Render method when you are using the code block @{}.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Stacy
Top achievements
Rank 1
answered on 16 Mar 2012, 01:51 PM
Hi Petur, I got the TabStrip to work just yesterday, but was just moving it from one location to another by this time and what i found was that the tabstrip renders fine in my partialview, only when it is not inside a form tag?  Why can the tabstrip not be within a form ? 

Stacy
0
Petur Subev
Telerik team
answered on 16 Mar 2012, 02:49 PM
Hi Stacy,

There should not be any problems to put the TabStrip into a form element.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Stacy
Top achievements
Rank 1
answered on 16 Mar 2012, 03:28 PM
Great, thanks. it is syntax related, and from your first reply regarding the @90 and @{} I think I know what to do now, thanks a lot!
Tags
TabStrip
Asked by
Stacy
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Stacy
Top achievements
Rank 1
Share this question
or