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

[Solved] Grid editing using popup Mode

4 Answers 150 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.
Dominic
Top achievements
Rank 1
Dominic asked on 29 Apr 2012, 06:04 PM

Hi

I'm trying to insert data in my grid by using the popup mode but it not working at all. I always receive the error "Value cannot be null. Parameter name: name". If i'm using the inline mode, the operation works as expected. I dont understand where my problem can be since no additionnal code seems to be needed to work in popup mode instead of inline mode.

Thanks in advance

There is my Grid definition :
@{ Html.Telerik().Grid<TableauDeBordDeGestion.Models.AnalyseViewModel>()
 
       .Name("GridAnalyses")
       .DataKeys(keys => keys.Add(o => o.Id).RouteKey("idAnalyse"))                
       .ToolBar(commands => commands.Insert())
       .DataBinding(databinding => databinding
       .Ajax()
 
            .Select("AnalysesAjax", "tb")
            .Update("UpdateAnalyse", "tb")
            .Delete("DeleteAnalyse","tb")
            .Insert("InsertAnalyse", "tb")
       )
        
       .Columns(columns =>
       {
           columns.Bound(o => o.Commentaire).Title("Commentaire").Encoded(false);
           columns.Bound(o => o.DateAjout).Title("Date ajout").Format("{0:yyyy-MM-dd}").ReadOnly(true);
           columns.Command(commands => commands.Delete().ButtonType(GridButtonType.Image));
           columns.Command(commands => commands.Edit().ButtonType(GridButtonType.Image));
           
       })
        
       .ClientEvents(events => events.OnEdit("onEdit"))
       .Editable(editing =>
        
           editing.DefaultDataItem(new TableauDeBordDeGestion.Models.AnalyseViewModel
           {
               DateAjout = DateTime.Now,
               Usager = HttpContext.Current.User.Identity.Name
          
           }))
           
    .Editable(editing => editing.Mode(GridEditMode.PopUp))
   .Sortable()
   .Groupable(grouping => grouping
          .Groups(groups =>
          {
              groups.Add(c => c.DateAjout);
              groups.Add(c => c.Usager);
               
          }))  
   .Pageable(pagerAction => pagerAction.Position(GridPagerPosition.Bottom))
   .Pageable(pagerAction => pagerAction.PageSize(10)) 
 
   .Render();
    
}

4 Answers, 1 is accepted

Sort by
0
Heimo Hammer
Top achievements
Rank 1
answered on 30 Apr 2012, 07:03 AM
Strange, try to comment the OnEdit event you have defined - your scripts might cause the error for some reason
0
Dominic
Top achievements
Rank 1
answered on 30 Apr 2012, 02:20 PM
Hi,

Thanks for your helps. i try to comment the onEdit client event but no chance the problem still there... I'm sure it will be really easy to fix but i cant figure out where is my problem.

Thanks
0
Petur Subev
Telerik team
answered on 30 Apr 2012, 02:25 PM
Hi Dominic,

Could you please try and prepare a small project which replicates the issue so we can check what causes it ?

Regards,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Chris
Top achievements
Rank 1
answered on 10 Dec 2012, 03:23 PM
Was a solution for this ever found?  I am having a very similar issue.  I have a javascript method that fires onedit and hides certain fields for the add new record popup, (since I never found a different way to do this.....) however only one field actually has a value.

Something interesting to note. the object that I am using as the model for the grid implements an interface which implements another interface.  The property that has a value is the property on the interface the object directly implements, properties from the parent interface are the ones that don't seem to be set.

so for example I have
InterfaceA which has property X
InterfaceB which implements InterfaceA and has property Y
ObjectC which implements InterfaceB

when my ajax insert method is fired the only property that has a value is Y even though I typed a value into the text box for X.

Any thoughts?
Tags
Grid
Asked by
Dominic
Top achievements
Rank 1
Answers by
Heimo Hammer
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Petur Subev
Telerik team
Chris
Top achievements
Rank 1
Share this question
or