I'm trying to create a VERY SIMPLE grid where a user can enter data. No formatting, no AJAX stuff, just enter data and then submit the entire page. It's proving to be quite a task.
I'll go into my complaints about the standard Add Row behavior in another post. But right now I can't seem to add a row to the grid using the CSOM. Calls like this:
grid.get_rows().add({ "ID": "20", "Quantity": "1", "ModelNumber": "2", "SerialNumber": "3", "Description": "None" });grid.get_rows().add(["20","1", "2", "3", "None" ]);
just return various different server-side errors (even though I've done all I can so that it doesn't do a postback for a new record -- can't a new row be added without a server call?)
The first method returns this error:
[InvalidCastException]: Unable to cast object of type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' to type 'System.Object[]'.
at Infragistics.Web.UI.GridControls.GridBot.LoadAdditionalClientState(Object state)
at Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent()
at System.Web.UI.Page.RaiseChangedEvents()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
[HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.netapp_newrequest_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\49289e6c\1b9e68a0\App_Web_0ihku952.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
and the second call returns this error:
[NullReferenceException]: Object reference not set to an instance of an object.
at ASP.netapp_newrequest_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\49289e6c\1b9e68a0\App_Web_fwwrhmj8.0.cs:line 0
How can I stop these errors? Better yet, can I get add row to occur without a server side call back?
The grid is bound to a very simple DataTable at runtime that looks like this:
DataTable dt = new DataTable();dt.Columns.Add(new DataColumn("ID"));dt.Columns.Add(new DataColumn("Quantity"));dt.Columns.Add(new DataColumn("ModelNumber"));dt.Columns.Add(new DataColumn("SerialNumber"));dt.Columns.Add(new DataColumn("Description"));
dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] };
dt.Rows.Add(new object[] { "0" });dt.Rows.Add(new object[] { "1" });dt.Rows.Add(new object[] { "2" });dt.Rows.Add(new object[] { "3" });
hardware.DataSource = dt;hardware.DataBind();hardware.DataKeyFields = "ID";
Thanks for any assistance.
Hi,
What build version is being used? This should be fixed in the latest service release.
I got this with version 9.1.20091.2087....