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

Problem with Grid inside tabstrip insert function

2 Answers 90 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.
Jack Ma
Top achievements
Rank 1
Jack Ma asked on 11 May 2010, 07:57 AM
Hi ,
   I have a tabstrip with each tab has a grid, there's a insert button on the top of the grid, the initial load of the tabstrip and grid is perfect, but while I click the insert button, there promopts a grand new page with the field spaces to be entered, what I mean is the add new item page should be inside the tab but not a whole white page.
   Inside the tab, the grid showing is using partial view.
   Can anybody explain this? Very appreciate!

Regards
Jack

2 Answers, 1 is accepted

Sort by
0
Jack Ma
Top achievements
Rank 1
answered on 12 May 2010, 02:07 AM
Nobody reply?
I'm using contentUrl to load the content in tab by partial view, below is the aspx file
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<OrganizationNavigationViewModel>" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">  
 
    <h2><%=iNuggets.Resources.Globalization.MyOrganizationUserInRole%></h2>  
<%   
     Html.Telerik().TabStrip()  
           .Name("TabStrip")  
           .BindTo(Model.OrganizationNavigationData,  
                   (item, OrganizationNavigationData) => 
                   {  
                       item.Text = OrganizationNavigationData.Text;  
                       item.ContentUrl = OrganizationNavigationData.ContenUrl;  
                         
                   })  
           .SelectedIndex(0)          
           .Render();  
      
%> 
</asp:Content> 
 
<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">  
</asp:Content> 
 
 
and the partial view ascx file is
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<OrganizationUsersPartialViewModel>" %> 
<%  
    if (Model.OrganizationUsers != null)  
    {  
 
        Html.Telerik().Grid(Model.OrganizationUsers)  
        .Name("OrganizationAdministrator")  
        .ToolBar(commands => commands.Insert())  
        .DataKeys(keys => keys.Add(c => c.ID))  
        .Columns(columns => 
        {  
            columns.Bound(c => c.UserName).Width(130);  
            columns.Bound(c => c.Email).Width(130);  
            columns.Bound(c => c.OrganizationRole).Width(130);  
            columns.Command(commands => 
            {  
                commands.Delete();  
            }).Width("20%").Title(iNuggets.Resources.Globalization.Commands);  
        })  
        .DataBinding(dataBinding => 
        {  
            dataBinding.Ajax()  
            .Select("MyOrganizationUserInRolePartial", "MyOrganization", new { ActionName = "Select" })  
            .Insert("MyOrganizationUserInRolePartial", "MyOrganization", new { ActionName = "Insert" })  
            .Delete("MyOrganizationUserInRolePartial", "MyOrganization", new { ActionName = "Delete" });  
        })  
              
        .Pageable()  
        .Sortable()  
        .Render();  
    }  
 
 %> 
 

the inital page loading is perfect, but once click the insert button, the content is not shown in the tab but instead shown in a grand new white page,  it seems that it missed the content placeholder, but how can I fix this?

Any reply, appreciate!

Regards
Jack
0
Naresh kumar
Top achievements
Rank 2
answered on 09 May 2012, 04:46 AM

I also faced the same issue. Below highlighted resolves my issue. In my case I'm using ajax binding.

.ToolBar(commands => commands.Position(GridToolBarPosition.Top).Insert().ButtonType(GridButtonType.BareImage).HtmlAttributes(new { Href = "javascript:void(0);" }).ImageHtmlAttributes(new {style = "margin-left:0" })) 


When the grid try to load all the javascript in clientside by the time if you press insert button it will do the full postback instead of calling the javascript method.
The above line stops the postback always and it will work once the grid related javascript files loaded.

Thanks,
Naresh Kumar Murthy
Tags
TabStrip
Asked by
Jack Ma
Top achievements
Rank 1
Answers by
Jack Ma
Top achievements
Rank 1
Naresh kumar
Top achievements
Rank 2
Share this question
or