We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridMode is null

The GridEditMode parameter is never passed from the client.
 

public ActionResult Index(PagingParams args, int? Id, GridEditMode? GridMode)

 

For example, the PagingParams are passed on BeginEdit, but GridMode is not.

I've tried using different edit modes but get the same results.

 

Syncfusion.Grid.Mvc, Version=11.2440.0.25


10 Replies

ES Eswari S Syncfusion Team September 20, 2013 07:01 AM UTC

Hi Jeremy,

 

Thank you for using Syncfusion products.

 

We are passing PagingParams for our Grid Operations. GridEditMode is optional one so we didn’t passed that from client model. We can pass this using QueryParam. Please refer to the following code snippets:

 

      @( Html.Syncfusion().Grid<Sample.Models.Order>("SampleGrid")

                                            .Editing(edit =>

                                            {

                                                edit.AllowEdit(true)

                                                    .AllowNew(true)

                                                    .AllowDelete(true);

                                                  edit.EditMode((GridEditMode)Convert.ToInt32(ViewData["Mode"]));

                                                edit.PrimaryKey(key => key.Add(p => p.OrderID));

                                            })

                                                  .QueryParam("?GridMode=" + Convert.ToInt32(ViewData["Mode"])  // Query params

              ))

 

Please find sample for your convenience:

 

Sample.zip

 

You can also check online sample for your reference:

 

http://mvc.syncfusion.com/demos/ui/grid/Editing/InlineEdit

 

Please try this and let us know if you have any queries.

 

Regards,

Eswari S

 

 



JB Jeremy Branham September 26, 2013 04:01 AM UTC

Thank you Eswari -
I can see now how to pass values on the query string.
 
But I do see many parameters being passed from the client that are not being picked up in the POST.
 
Example "GridRequestParams" is a key in the form being posted -
{"RequestType":9,"gridID":"GenericListGrid","PrimaryKeys":["Id"],"PrimaryKeyValues":["2"],"GridSaveMapper":"/Environments/Save","GridEditMode":"InlineForm"}
 
Example "ClientObject" is another key that is being posted -
{"AutoFormat":2,"AllowSorting":false,"AllowPaging":true,"AllowGrouping":false,"HttpRequestType":"post","ShowCaption":false,"ShowRowHeader":false,"VisibleColumns":[{"Name":"Id","Member":"Id","type":"Int32","HeaderText":"Id","FormatText":"","JqueryFormat":"","Visible":true,"CssName":null,"Width":-1,"AllowFilter":true,"IsUnbound":false,"cellEditType":0,"numericEditParams":null,"percentEditParams":null,"maskEditParams":null,"TemplateColumn":false,"TemplateName":null,"AllowEditing":true,"ResizeSettings":true,"TextAlign":0,"AllowAutoWrap":true,"AllowSearching":true,"AllowContextMenu":true,"AllowFormatinEditMode":false,"DropDownDataSource":null,"DataTextField":"","DataValueField":"","HtmlEncode":false,"IsNullable":false,"GridCommands":""},{"Name":"Name","Member":"Name","type":"String","HeaderText":"Name","FormatText":"","JqueryFormat":"","Visible":true,"CssName":null,"Width":-1,"AllowFilter":true,"IsUnbound":false,"cellEditType":0,"numericEditParams":null,"percentEditParams":null,"maskEditParams":null,"TemplateColumn":false,"TemplateName":null,"AllowEditing":true,"ResizeSettings":true,"TextAlign":0,"AllowAutoWrap":true,"AllowSearching":true,"AllowContextMenu":true,"AllowFormatinEditMode":false,"DropDownDataSource":null,"DataTextField":"","DataValueField":"","HtmlEncode":false,"IsNullable":false,"GridCommands":""},{"Name":"ExternalId","Member":"ExternalId","type":"Int32","HeaderText":"ExternalId","FormatText":"","JqueryFormat":"","Visible":true,"CssName":null,"Width":-1,"AllowFilter":true,"IsUnbound":false,"cellEditType":2,"numericEditParams":null,"percentEditParams":null,"maskEditParams":null,"TemplateColumn":false,"TemplateName":null,"AllowEditing":true,"ResizeSettings":true,"TextAlign":0,"AllowAutoWrap":true,"AllowSearching":true,"AllowContextMenu":true,"AllowFormatinEditMode":false,"DropDownDataSource":null,"DataTextField":"","DataValueField":"","HtmlEncode":false,"IsNullable":true,"GridCommands":""},{"Name":"ContactId","Member":"ContactId","type":"Int32","HeaderText":"ContactId","FormatText":"","JqueryFormat":"","Visible":true,"CssName":null,"Width":-1,"AllowFilter":true,"IsUnbound":false,"cellEditType":2,"numericEditParams":null,"percentEditParams":null,"maskEditParams":null,"TemplateColumn":false,"TemplateName":null,"AllowEditing":true,"ResizeSettings":true,"TextAlign":0,"AllowAutoWrap":true,"AllowSearching":true,"AllowContextMenu":true,"AllowFormatinEditMode":false,"DropDownDataSource":null,"DataTextField":"","DataValueField":"","HtmlEncode":false,"IsNullable":false,"GridCommands":""},{"Name":"AccountId","Member":"AccountId","type":"Int32","HeaderText":"AccountId","FormatText":"","JqueryFormat":"","Visible":true,"CssName":null,"Width":-1,"AllowFilter":true,"IsUnbound":false,"cellEditType":6,"numericEditParams":null,"percentEditParams":null,"maskEditParams":null,"TemplateColumn":false,"TemplateName":null,"AllowEditing":true,"ResizeSettings":true,"TextAlign":0,"AllowAutoWrap":true,"AllowSearching":true,"AllowContextMenu":true,"AllowFormatinEditMode":false,"DropDownDataSource":[{"Id":1,"ParentAccountId":null,"Name":"test","ExternalId":"1","Address":"qweqw     ","City":"rere      ","State":"tx        ","Country":"yutryt    ","Phone":"1231231234","Status":"1         ","Contacts":null,"Licenses":null,"Environments":null,"PrimaryKeyPropertyNames":["Id"]},{"Id":2,"ParentAccountId":1,"Name":"qweqweqw","ExternalId":null,"Address":null,"City":null,"State":null,"Country":null,"Phone":null,"Status":null,"Contacts":null,"Licenses":null,"Environments":null,"PrimaryKeyPropertyNames":["Id"]},{"Id":3,"ParentAccountId":null,"Name":"qweqwe","ExternalId":null,"Address":null,"City":null,"State":null,"Country":null,"Phone":null,"Status":null,"Contacts":null,"Licenses":null,"Environments":null,"PrimaryKeyPropertyNames":["Id"]}],"DataTextField":"Name","DataValueField":"Id","HtmlEncode":false,"IsNullable":false,"GridCommands":""},{"Name":"Contact","Member":"Contact","type":"","HeaderText":"Contact","FormatText":"<a rel='nofollow' href='Contacts?ContactId={Id}'>Contact</a>","JqueryFormat":"","Visible":true,"CssName":null,"Width":-1,"AllowFilter":true,"IsUnbound":true,"cellEditType":0,"numericEditParams":null,"percentEditParams":null,"maskEditParams":null,"TemplateColumn":false,"TemplateName":null,"AllowEditing":true,"ResizeSettings":true,"TextAlign":0,"AllowAutoWrap":true,"AllowSearching":true,"AllowContextMenu":true,"AllowFormatinEditMode":false,"DropDownDataSource":null,"DataTextField":"","DataValueField":"","HtmlEncode":false,"IsNullable":false,"GridCommands":""},{"Name":"Environment Versions","Member":"Environment Versions","type":"","HeaderText":"Environment Versions","FormatText":"<a rel='nofollow' href='EnvironmentVersions?EnvironmentVersionId={Id}'>Environment Versions</a>","JqueryFormat":"","Visible":true,"CssName":null,"Width":-1,"AllowFilter":true,"IsUnbound":true,"cellEditType":0,"numericEditParams":null,"percentEditParams":null,"maskEditParams":null,"TemplateColumn":false,"TemplateName":null,"AllowEditing":true,"ResizeSettings":true,"TextAlign":0,"AllowAutoWrap":true,"AllowSearching":true,"AllowContextMenu":true,"AllowFormatinEditMode":false,"DropDownDataSource":null,"DataTextField":"","DataValueField":"","HtmlEncode":false,"IsNullable":false,"GridCommands":""}],"PageSize":12,"CurrentIndex":0,"SearchHiddenColumn":false,"SearchType":8,"AllowDeleting":true,"GroupedColumns":[],"CaptionText":"{Caption} : {TotalRecordsCount} Items","TotalRecordsCount":3,"EnableOnDemand":false,"AllowSummaries":false,"CurrentPageNo":1,"AllowFiltering":true,"AllowFormatFiltering":false,"AllowCaseSensitive":true,"AllowFormatGrouping":false,"SortColumn":[],"SortDirection":[],"FilterConditions":[],"AllowEditing":true,"ResizeSettings":{"ResizeToFit":false,"ClipContent":false},"AllowAutoWrap":false,"ShowStackedHeader":false,"StackedColumns":[],"MergeCells":[],"StackedRows":[],"AllowSearching":false,"SearchConditions":[],"ChildGrid":"","AllowNew":true,"AllowAlternateRowStyle":false,"AllowMergeCells":false,"Culture":"en-US","FilterMode":"Default"}
 
 
 
All that data could be useful during a post, I'm still trying to determine the best way to get to it.


JB Jeremy Branham September 26, 2013 04:50 AM UTC

Though, it looks like this data is only being posted when a template style edit form is not being used.


ES Eswari S Syncfusion Team September 27, 2013 09:42 AM UTC

Hi Jeremy,

 

Thanks for your update.

 

Query # All that data could be useful during a post, I'm still trying to determine the best way to get to it.

 

Could you please let us know which parameters you need to pass from client to PagingParams, so that we can analyze based on that and pass those aruguements to PagingParams from our source.

 

Query # Though, it looks like this data is only being posted when a template style edit form is not being used

 

We can able to see the issue and it has been confirmed as a defect; hence we have logged a defect report. However, we do not provide confidential information and patches in the general forum, so could you please create a new incident such that we can fix the issue and provide the patch for you.

 

Please let us know if you need any further assistance.

 

Regards,

Eswari S



JB Jeremy Branham September 28, 2013 01:20 AM UTC

Thanks Eswari.
 
The GridEditMode and primary key array would be very helpful.
 
I am using a dynamic mapping system to copy object properties from one instance of an object to another. I am also using a generic method to retrieve objects from a database.
The primary key must be known to pull the object correctly from the database.
The primary key list is required by the grid, so I would rather not create duplicate code.
 
I guess I could pass the primary key list from the domain object to the grid to eliminate duplicate code...
 
But having both of those fields available would be helpful.


ES Eswari S Syncfusion Team October 3, 2013 11:03 AM UTC

Hi Jeremy,

 

Thanks for your update.

 

Your requirement of getting primarykey and GridEditMode can achieved by de serializing  “GridRequestParams”. Please refer to the following code snippets:

 

[AcceptVerbs(HttpVerbs.Post)]

        public ActionResult Index(PagingParams args, int? OrderID, string GridRequestParams)   // Map GridRequestParams here

        {

            Dictionary<string, object> RequestArgs = (Dictionary<string, object>)new System.Web.Script.Serialization.JavaScriptSerializer().DeserializeObject(GridRequestParams);

 

            Object keyValues = RequestArgs["PrimaryKeyValues"];

 

            String editMode = RequestArgs["GridEditMode"].ToString();

                IEnumerable data = OrderRepository.GetAllRecords();

 

                return data.GridActions<EditableOrder>();

        }

 

http://www.syncfusion.com/downloads/support/directtrac/110793/Sample1634999941.zip

 

Please try this and let us know if you have any queries.

 

Regards,
Eswari S

 



JB Jeremy Branham October 4, 2013 12:59 AM UTC

Thanks Eswari.



ES Eswari S Syncfusion Team October 4, 2013 04:39 AM UTC

HI Jeremy,

 

Thanks for your update. Please let us know if you have any queries.

 

Regards,

Eswari S



JD Jean Domagni January 6, 2014 05:53 PM UTC

Hi Eswari,
I tried to download the grid sample you have in here. but it looks like it no longer available for download.
Can you please make this available? I need it 
Thank you


AS Alan Sangeeth S Syncfusion Team January 8, 2014 05:18 AM UTC

Hi Jean,

Thanks for using Syncfusion Products.

The Grid sample can be downloaded from below link.

Sample:

Sample.zip


Please let us know if you have any queries.

Regards,
Alan Sangeeth S

Loader.
Live Chat Icon For mobile
Up arrow icon