This question is locked. New answers and comments are not allowed.
Hi. I create asp.net mvc2 application using Telerik Extensions for ASP.NET MVC.
I have a simple model:
Home view with TabStrip:
and home controller with method:
I want to bind Selected tab in TabStrip to model field SelectedTab. How I can do it?
I have a simple model:
public class SimpleModel{ public string MyString { get; set; } public int MyInt { get; set; } public int SelectedTab { get; set; }}Home view with TabStrip:
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TelerikMvcApplication3.Models.SimpleModel>" %><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Home Page</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"><form runat="server"> <% Html.Telerik().TabStrip() .Name("TabStrip") .Items(items => { items.Add().Text("to int") .Content(()=> {%> <p><%:Html.TextBoxFor(m=>m.MyInt) %></p> <%}); items.Add().Text("to string") .Content(()=> {%> <p><%:Html.TextBoxFor(m=>m.MyString) %></p> <%}); }) .SelectedIndex(Model.SelectedTab) .Render(); %> <asp:Button ID="Button1" runat="server" Text="do action" /></form></asp:Content>and home controller with method:
[HttpPost]public ActionResult Index(SimpleModel model){ switch (model.SelectedTab) { case 0: IntAction(model.MyInt); break; case 1: StringAction(model.MyString); break; } return View(model);}I want to bind Selected tab in TabStrip to model field SelectedTab. How I can do it?