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

[Solved] Edit link in grid does not return page to tab area

2 Answers 72 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.
IQworks
Top achievements
Rank 1
IQworks asked on 10 Feb 2010, 05:12 PM
 Hi,
   I see now that when using selectedIndex, that this only takes affect when redisplaying the tab.
   I have a tab that successfully displays a grid in the appropriate tab area. I have a "Create" option on the grid that successfully redisplays the tab area with the Create Form. 
   My issue is that in the grid, i have a standard Edit link column. But when I select this, the Edit Form is returned as a full page instead of comming up within the tab area like my Create Form ?
   Here is some of the code for the successful Create ..... 
   This is the tab page ..... 
   
<%@ 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("Goals")  
                    .LoadContentFrom("LoadOnDemandDocument", "Work");  
 
                tabstrip.Add()  
                    .Text("Issues")  
                    .LoadContentFrom("LoadOnDemandDocument", "Work");  
                           
                tabstrip.Add()  
                    .Text("CompanyWork")  
                    .LoadContentFrom("CompanyGrid", "Work");  
                    //.Selected(true);  
 
                tabstrip.Add()  
                   .Text("CompanyNix")  
                   .LoadContentFrom("CompanyNix", "Company");  
 
                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("CompanyEdit", "Company")  
               .Visible((bool)TempData["EditVisible"]);  
                  
                tabstrip.Add()  
              .Text("CompanyTabs")  
              .LoadContentFrom("CompanyTabs", "Company");  
            })  
            .SelectedIndex(Convert.ToInt32(TempData["workIndex"]))   
            .Render();  
        %> 
</asp:Content> 
 

   This is the Gird ... 
<%@ 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", "CompanyEdit", new { Id = "{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 = 6 },null)%></p>   
        

   This is the action inside the controller that returns the Create page correctly .... 
  public ActionResult CompanyCreate()  
        {  
           return  View( );  
        } 

   This is the action inside the controller that incorrectly returns the Edit page as a full page .... 
 public ActionResult CompanyEdit(int id)  
        {  
            //   return View(repository.Get(id));  
            BCAEntities _dataModel = new BCAEntities();  
            var CompanyToEdit = (from m in _dataModel.Company   
                                where m.coCompanyNo == id  
                                select m).First();  
            return View(CompanyToEdit);  
        } 

   Any advice on how to have the Edit page appear inside the tab area instead as a full page ? 

  As alwats, thanks for your time.  

2 Answers, 1 is accepted

Sort by
0
IQworks
Top achievements
Rank 1
answered on 10 Feb 2010, 05:17 PM
 Sorry, forgot to include the "Index" from my Workcontroller .....
 
  public ActionResult Index(int? workindex)  
        {  
            TempData["workIndex"] = 0;  
            if(workindex != null)  
            TempData["workIndex"] = workindex;  
 
            if (workindex == 6) // Create new Company  
            {  
                TempData["EntryVisible"] = true;  
            }  
            else  
            {  
                TempData["EntryVisible"] = false;  
            }  
 
            if (workindex == 7) // Edit new Company  
            {  
                TempData["EditVisible"] = true;  
            }  
            else  
            {  
                TempData["EditVisible"] = false;  
            }  
 
            int keytest = Convert.ToInt32(Session["LastKey"]);  
            ViewData["orientation"] = "Horizontal"; // "Vertical";  
            return View();  
        }  
 
        

 Thanks again
0
IQworks
Top achievements
Rank 1
answered on 10 Feb 2010, 05:40 PM
Ok, the problem is that the Actionlink for the Create is going to the WorkController Index Action and passing the workindex parameter, so this redisplays the tab with the Create page in the tab area.
The Edit on the other hand is going to the CompanyController and is NOT passing the workindex parameter, so , it never goes to the Index Action of the WorkController.
Sorry, thanks
 
Tags
TabStrip
Asked by
IQworks
Top achievements
Rank 1
Answers by
IQworks
Top achievements
Rank 1
Share this question
or