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

[Solved] Popup Edit Templates include two Grid

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Caleter
Top achievements
Rank 1
Caleter asked on 15 Mar 2012, 09:09 AM

Hi,
I have a Grid and use Popup Edit Templates,

and the Edit Templates include two Grid,

first Grid is normal operation,

but I cannot control the second Grid,

it cannot get anything from control,

even 「add」 or 「edit」, 
when i click the second Grid's add or edit,
the popup form will be crash...

how do I solve this problem??


Its my popup's code

@(
         Html.Telerik()
             .Grid<Stoneax.Enterprise.ERP.Models.AddressModel>()
             .Name("Grid")
             .DataKeys(keys => keys.Add(p => p.ID))
             .DataBinding(dataBinding =>
              {
               dataBinding.Ajax().Insert("AddressCreate", "Company").Select("AddressIndex", "Company", new { ID_ENTREGA_TALONARIO = Model.ID }).Update("AddressEdit", "Company").Delete("AddressDelete", "Company");
              })
             .ToolBar(commands => commands.Insert().ImageHtmlAttributes(new {style = "margin-left:0"}))
             .Columns(columns =>
               {
                 columns.Command(commands =>
             {
              commands.Edit().ButtonType(GridButtonType.Text);
              commands.Delete().ButtonType(GridButtonType.Text);
             }).Width(180).Title("Commands");
                       columns.Bound(o => o.AddressTitle).Width(100);
                       columns.Bound(o => o.Area).Width(80);
                       columns.Bound(o => o.SectorCode).Width(80);
                       columns.Bound(o => o.AddressContent).Width(80)
               })
             .Editable(editing => editing.Mode(GridEditMode.PopUp))
             .Sortable())
 
         <div>Contact</div>
@(
         Html.Telerik()
             .Grid<Stoneax.Enterprise.ERP.Models.ContactModel>()
             .Name("Grid2")
             .DataKeys(keys => keys.Add(p => p.ID))
             .DataBinding(dataBinding =>
              {
                dataBinding.Ajax().Insert("ContactCreate", "Company").Select("ContactIndex", "Company", new {ID_ENTREGA_TALONARIO = Model.ID}).Update("ContactEdit", "Company").Delete("ContactDelete", "Company");
              })
             .ToolBar(commands => commands.Insert().ImageHtmlAttributes(new {style = "margin-left:0"}))
             .Columns(columns =>
               {
                 columns.Command(commands =>
            {
               commands.Edit().ButtonType(GridButtonType.Text);
               commands.Delete().ButtonType(GridButtonType.Text);
            }).Width(180).Title("Commands");
                        columns.Bound(o => o.Name).Width(100);
                        columns.Bound(o => o.Nickname).Width(80);
                        columns.Bound(o => o.Phone1).Width(80);
                        columns.Bound(o => o.Phone2).Width(80);
               })
             .Editable(editing => editing.Mode(GridEditMode.PopUp))
             .Sortable())

1 Answer, 1 is accepted

Sort by
0
Caleter
Top achievements
Rank 1
answered on 20 Mar 2012, 02:50 AM
I'm trying to creat grid with custom edit form ,


My Model

 public class Company
    {
        public Guid ID { get; set; }

        public string Name { get; set; }

        public List<Contact> ContactCollection { get; set; }

        public List<Address> AddressCollection { get; set; }
    }

 public class Contact
    {
        public Guid ID { get; set; }

        public string Name { get; set; }

        public string Phone1 { get; set; }
    }

 public class Address
    {
        public Guid ID { get; set; }

        public string AddressTitle { get; set; }

        public string AddressContent { get; set; }
    }


Index form

@(        
 Html.Telerik()
     .Grid(Model)
     .Name("Grid")
     .DataKeys(keys => keys.Add(p => p.ID))
     .DataBinding(dataBinding =>
      {
      dataBinding.Ajax().Select("CompanyIndex", "Home").Insert("CompanyCreate", "Home")
                              .Update("CompanyEdit", "Home").Delete("CompanyDelete", "Home");
      })
       .ToolBar(commands => commands.Insert().ImageHtmlAttributes(new { style = "margin-left:0" }))
       .Columns(columns =>
            {
                columns.Command(commands =>
           {
                    commands.Edit().ButtonType(GridButtonType.Text);
                    commands.Delete().ButtonType(GridButtonType.Text);
                }).Width(180).Title("Commands");
                columns.Bound(o => o.ID).Width(200);
                columns.Bound(o => o.Name).Width(200);
                 
            })
       .Editable(editing => editing.Mode(GridEditMode.PopUp))
       .Filterable(filterable => filterable.Enabled(true))
       .Groupable(grouped => grouped.Enabled(true))
       .Sortable()
)


coustom 
edit form 

<div>Contact</div>
 @(
     Html.Telerik()
       .Grid<TestWeb.Models.Contact>()
       .Name("ContactGrid")
       .DataKeys(keys => keys.Add(p => p.ID))
       .DataBinding(dataBinding =>
         {
        dataBinding.Ajax().Insert("ContactCreate", "Home").Select("ContactIndex", "Home")
                    .Update("ContactEdit", "Home").Delete("ContactDelete", "Home");
         })
        .ToolBar(commands => commands.Insert().ImageHtmlAttributes(new {style = "margin-left:0"}))
        .Columns(columns =>
         {
             columns.Command(commands =>
                   {
                        commands.Edit().ButtonType(GridButtonType.Text);
                        commands.Delete().ButtonType(GridButtonType.Text);
                   }).Width(180).Title("Commands");
             columns.Bound(o => o.Name).Width(80);
             columns.Bound(o => o.Phone1).Width(80);
         })
            .Editable(editing => editing.Mode(GridEditMode.PopUp))
            .Sortable())
<div>Address</div>
@(
   Html.Telerik()
       .Grid<TestWeb.Models.Address>()
       .Name("AddressGrid")
       .DataKeys(keys => keys.Add(p => p.ID))
       .DataBinding(dataBinding =>
           {
               dataBinding.Ajax().Insert("AddressCreate", "Home").Select("AddressIndex", "Home")
                          .Update("AddressEdit", "Home").Delete("AddressDelete", "Home");
           })
        .ToolBar(commands => commands.Insert().ImageHtmlAttributes(new {style = "margin-left:0"}))
        .Columns(columns =>
              {
                 columns.Command(commands =>
                    {
                          commands.Edit().ButtonType(GridButtonType.Text);
                          commands.Delete().ButtonType(GridButtonType.Text);
                    }).Width(180).Title("Commands");    
                     columns.Bound(o => o.AddressTitle).Width(80);
                     columns.Bound(o => o.AddressContent).Width(80);
               })
         .Editable(editing => editing.Mode(GridEditMode.PopUp))
         .Sortable())



but in the coustom edit form,
AddressGrid is not work,
It can't run to GridControl ,
so it can't ajax blind AddressModel,and the add buttom is also not working(click it than form will be off),
but  contact grid has good work!!,

if I exchange two grid ,AddressGrid will be good work!
but ContactGrid will not work......



how to fix it??


It's my testproject
Tags
Grid
Asked by
Caleter
Top achievements
Rank 1
Answers by
Caleter
Top achievements
Rank 1
Share this question
or