This question is locked. New answers and comments are not allowed.
Hi,
I have a tabstrip that has 3 tabs.
"Company Grid" "Create Company" "Edit Company"
When the Grid is displayed, it has a link at the bottom to "Create", and, a column on every grid line to "Edit".
If I keep the Create and Edit tabs visible. I can click the Create link and the "Create Company" tab area displays with the entry form. If I click on the Edit link of an grid row, the "Edit Company" taba area displays the edit form with the appropriate data to edit.
I decided i only wanted the "Create Company" and "Edit Company" tabs to be displayed when I select either the Create or Edit links from the grid.
The problem is that when I make both the "Create Company" and "Edit Company" tab Visible property "false", I can use the selected index to display the Create tab and it displays the create form correctly. But when I try to use the selected index to display the "Edit Company" tab and tab area, only the tab displays ? The Edit tab area does not appear with the appropriate or any Edit form.
I am not understanding how the Visible property works with the selected index ?
This is the WorkController Index method ...
This is the Grid page ....
This is the WorkController
Thanks for your time.
I have a tabstrip that has 3 tabs.
"Company Grid" "Create Company" "Edit Company"
When the Grid is displayed, it has a link at the bottom to "Create", and, a column on every grid line to "Edit".
If I keep the Create and Edit tabs visible. I can click the Create link and the "Create Company" tab area displays with the entry form. If I click on the Edit link of an grid row, the "Edit Company" taba area displays the edit form with the appropriate data to edit.
I decided i only wanted the "Create Company" and "Edit Company" tabs to be displayed when I select either the Create or Edit links from the grid.
The problem is that when I make both the "Create Company" and "Edit Company" tab Visible property "false", I can use the selected index to display the Create tab and it displays the create form correctly. But when I try to use the selected index to display the "Edit Company" tab and tab area, only the tab displays ? The Edit tab area does not appear with the appropriate or any Edit form.
I am not understanding how the Visible property works with the selected index ?
This is the WorkController Index method ...
| <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Work.Master" |
| Inherits="System.Web.Mvc.ViewPage" %> |
| <asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server"> |
| Home Page |
| </asp:Content> |
| <asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server"> |
| <h2>Analytics Work Page</h2> |
| <% Html.Telerik().TabStrip() |
| .Name("BCAMainTab") |
| .Items(tabstrip => |
| { |
| tabstrip.Add() |
| .Text("Analytic Data") |
| /* this tab will be opened initially - no need to get it with ajax */ |
| .Content(() => |
| {%> |
| <p> |
| Select the data you need to maintain or need to check. |
| </p> |
| <%}); |
| tabstrip.Add() |
| .Text("Company") |
| .HtmlAttributes(new { style="background-color:blue;color:white;" }) |
| .LoadContentFrom("CompanyGrid", "Company"); |
| tabstrip.Add() |
| .Text("Enter Company") |
| .HtmlAttributes(new { style = "background-color:blue;color:white;" }) |
| .LoadContentFrom("CompanyCreate", "Company") |
| .Visible((bool)TempData["EntryVisible"]); |
| tabstrip.Add() |
| .Text("Edit Company") |
| .HtmlAttributes(new { style = "background-color:blue;color:white;" }) |
| .LoadContentFrom(Url.Action("CompanyEdit", "Company", new { id = 2 })) |
| .Visible((bool)TempData["EditVisible"]); |
| }) |
| .SelectedIndex(Convert.ToInt32(TempData["workIndex"])) |
| .Render(); |
| %> |
| </asp:Content> |
This is the Grid page ....
| <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<BCAnalytics.Models.CompanyVM>>" %> |
| <p><%= Html.ActionLink("Close", "Index", "Work", new { workindex = 0 },null)%></p> |
| <%= Html.Telerik().Grid(Model) |
| .Name("CompanyGrid") |
| .Columns(columns => |
| { |
| // columns.Add(o => o.cMemberNo).Width(30) ; |
| // columns.Add(o => o.cCompanyNo).Width(30); |
| columns.Add(o => o.cCompanyName).Width(200).Title("Company"); |
| columns.Add(o => o.cEmail).Title("GroupCode"); |
| columns.Add(o => o.cGroupCode).Width(120).Title("Email"); |
| columns.Add(o => o.cDateUpdated).Format("{0:MM/dd/yyyy}").Width(85).Title("Updated"); |
| columns.Add(o => o.cCompanyNo).Format(Html.ActionLink("Edit", "Index", "Work", new {workindex=3,OtherParms= "{0}" }, null).ToString()).Encoded(false).Title("").Width(32); |
| columns.Add(o => o.cCompanyNo).Format(Html.ActionLink("Delete", "CompanyDelete", new { Id = "{0}" }, null).ToString()).Encoded(false).Title("").Width(50); |
| }) |
| .Ajax(settings => settings.Action("_AjaxBindingCompany", "Company")) |
| .Pageable() |
| .Sortable(sort => sort.SortMode(GridSortMode.MultipleColumn)) |
| .Scrollable(scrolling => scrolling.Height(200)) |
| .Filterable() %> |
| <p><%= Html.ActionLink("Create New Company", "Index", "Work", new { workindex = 2, OtherParms="" },null)%></p> |
This is the WorkController
| public ActionResult Index(int? workindex, string OtherParms) |
| { |
| TempData["workIndex"] = 0; |
| if(workindex != null) |
| TempData["workIndex"] = workindex; |
| // Create new Company |
| if (workindex == 2) |
| { |
| TempData["EntryVisible"] = true; |
| } |
| else |
| { |
| TempData["EntryVisible"] = false; |
| } |
| // Edit new Company |
| if (workindex == 3) |
| { |
| TempData["EditVisible"] = true; |
| Session["CompanyIdToEdit"] = OtherParms; |
| // CompanyController ced = new CompanyController(); |
| // ViewResult vr = new ViewResult(); |
| // vr = (ViewResult)ced.CompanyEdit(Convert.ToInt32(OtherParms)); |
| // return View(vr); |
| } |
| else |
| { |
| TempData["EditVisible"] = false; |
| } |
| int keytest = Convert.ToInt32(Session["LastKey"]); |
| ViewData["orientation"] = "Horizontal"; // "Vertical"; |
| return View(); |
| } |
Thanks for your time.