Hello,
I am using version 14.1.20141.2150 of the WebDataGrid. On my grid I have both row editing and row adding. I have four asp.net validation controls attached to four of the editor controls. This validation is only on row adding (This is because the respective fields are read only on row editing.)
Editor Providers:
<EditorProviders>
<ig:TextEditorProvider ID="tepFirstName">
<EditorControl ClientIDMode="Predictable"/>
</ig:TextEditorProvider>
<ig:TextEditorProvider ID="tepLastName">
<ig:TextEditorProvider ID="tepEmail">
<ig:MaskEditorProvider ID="mepPhone">
<EditorControl ID="ecPhone" ClientIDMode="Predictable" BorderStyle="None" InputMask="(###) ###-#### Ext. 99999"></EditorControl>
</ig:MaskEditorProvider>
<ig:TextEditorProvider ID="tepPhone">
</EditorProviders>
Row Adding Column Settings:
<ig:RowAddingColumnSetting ColumnKey="FirstName" ReadOnly="False" EditorID="tepFirstName" ValidatorID="valFirstNameRequired"/>
<ig:RowAddingColumnSetting ColumnKey="LastName" ReadOnly="False" EditorID="tepLastName" ValidatorID="valLastNameRequired"/>
<ig:RowAddingColumnSetting ColumnKey="Position" ReadOnly="False" />
<ig:RowAddingColumnSetting ColumnKey="EmailAddress" ReadOnly="False" EditorID="tepEmail" ValidatorID="cvEmail"/>
<ig:RowAddingColumnSetting ColumnKey="Phone" ReadOnly="False" EditorID="mepPhone" ValidatorID="cvPhone" />
Asp Validators:
<asp:RequiredFieldValidator runat="server" ID="valFirstNameRequired" ControlToValidate="wdgContacts" ForeColor="" CssClass="igg_NavisphereValidationErrorMessage" />
<asp:RequiredFieldValidator runat="server" ID="valLastNameRequired" ControlToValidate="wdgContacts" ForeColor="" CssClass="igg_NavisphereValidationErrorMessage" />
<asp:CustomValidator runat="server" ID="cvEmail" ControlToValidate="wdgContacts" CssClass="igg_NavisphereValidationErrorMessage" ClientValidationFunction="wdgContacts_cvEmail" />
<asp:CustomValidator runat="server" ID="cvPhone" ControlToValidate="wdgContacts" CssClass="igg_NavisphereValidationErrorMessage" ClientValidationFunction="wdgContacts_cvPhone"/>
The validation on row adding works correctly on the clientside but as soon as I click the save button to execute the post back it returns an "Object reference not set to an instance of an object." error occurs. The NullReferenceException appears to occur on the "ColumnEditSettings" Infragistics file at line 207. (Full File Path: Source\Infragistics.Web.UI\GridControls\WebDataGrid\Behaviors\EditableBehaviorBase\ColumnEditSetting.cs:207 )
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] Infragistics.Web.UI.GridControls.ColumnEditSetting.SaveClientProperties() in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\GridControls\WebDataGrid\Behaviors\EditableBehaviorBase\ColumnEditSetting.cs:207 Infragistics.Web.UI.GridControls.RowAddingColumnSetting.SaveClientProperties() in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\GridControls\WebDataGrid\Behaviors\Editing\RowAdding\RowAddingColumnSetting.cs:123 Infragistics.Web.UI.Framework.ObjectBase.Infragistics.Web.UI.IClientState.SaveClientProperties() in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:654 Infragistics.Web.UI.Framework.ObjectBase.WriteClientCollections(StringBuilder builder, ArrayList collections) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:870 Infragistics.Web.UI.Framework.ObjectBase.WriteClientState(StringBuilder builder) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:814 Infragistics.Web.UI.Framework.ObjectBase.Infragistics.Web.UI.IClientState.WriteClientState(StringBuilder builder) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:669 Infragistics.Web.UI.Framework.ObjectBase.WriteClientObjects(StringBuilder builder, ArrayList objects) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:839 Infragistics.Web.UI.Framework.ObjectBase.WriteClientState(StringBuilder builder) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:806 Infragistics.Web.UI.Framework.ObjectBase.Infragistics.Web.UI.IClientState.WriteClientState(StringBuilder builder) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:669 Infragistics.Web.UI.Framework.ObjectBase.WriteClientObjects(StringBuilder builder, ArrayList objects) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:839 Infragistics.Web.UI.Framework.ObjectBase.WriteClientState(StringBuilder builder) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\ObjectBase.cs:806 Infragistics.Web.UI.Framework.RunBot.PopulateScriptDescriptor(ScriptBehaviorDescriptor descriptor) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\RunBot.cs:290 Infragistics.Web.UI.GridControls.GridBot.PopulateScriptDescriptor(ScriptBehaviorDescriptor descriptor) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\GridControls\WebDataGrid\GridBot.cs:68 Infragistics.Web.UI.Framework.Data.<GetScriptDescriptors>d__0.MoveNext() in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\Data\FlatDataBoundControl.cs:1109 System.Web.UI.ScriptControlManager.RegisterScriptsForScriptDescriptors(IEnumerable`1 scriptDescriptors, Control control) +63 System.Web.UI.ScriptControlManager.RegisterScriptDescriptors(IScriptControl scriptControl) +140 Infragistics.Web.UI.Framework.RunBot.RegisterScriptDescriptors() in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\RunBot.cs:421 Infragistics.Web.UI.GridControls.GridBot.RegisterScriptDescriptors() in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\GridControls\WebDataGrid\GridBot.cs:646 Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.Render(HtmlTextWriter writer) in e:\work\3\559\src\RELEASE\ASP.NET\2014.1\Source\Infragistics.Web.UI\Framework\Data\FlatDataBoundControl.cs:647 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 ASP.tasks_carrier_maintaincarriercontacts_aspx.__RenderContent1(HtmlTextWriter __w, Control parameterContainer) in C:\Workspaces\eComm\Navisphere\DEV\BidManagement.WebUI\Tasks\Carrier\MaintainCarrierContacts.aspx:77 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8 System.Web.UI.Control.Render(HtmlTextWriter writer) +10 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128 System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +216 System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32 System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8 System.Web.UI.Control.Render(HtmlTextWriter writer) +10 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8 System.Web.UI.Page.Render(HtmlTextWriter writer) +29 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57 System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386
Notes:
I was not able to create a basic example replicating this issue. There appears to be something wrong with the validator logic to hook the grid editor back up with the validator on postback/page render.
Questions:
What appears to be the issue here? Am I missing some attributes on my editors or validators that is causing the null exception?
Things I have tried:
I have tried adding the validators to the CellEditting ColumnSettings fields as well, in case it was throwing an error because it could no longer find the linked validators. This did not work.
Has anyone else had this issue and know what is causing it?
Thanks,
Mason
I also want to mention that I have verified that the Row Adding process works correctly with no exception when I do not have the Validation controls associated with the editor providers. Specifically when I remove the "ValidationID" property from the Row Adding Column Settings elements.
Hello Mason O'Neil,
Thank you for posting on our forums.
May I ask if you can provide more details about how you are handling the adding and updating a records on the server? Do you have AutoCRUD enabled? Are the record updated on the server without issues?
Please provide more details about your server-side logic and I will be happy to investigate this issue further.
I do not have AutoCRUD enabled. I handle the RowUpdating and RowAdding events accordingly.
The RowAdding event successfully finishes and the data is added to the database. The error appears to occur on the postback to the page after the server calls.
After the error occurs, I leave the page and come back. When I return to the page, I can confirm that the record was in fact added. This is why I believe it has something to do with the conversion of the row from a "RowAdding" row to a "CellEditting" row (if that makes sense).
Thanks,Mason
Hi Mason O'Neil,
Thank you for the update.
Please provide me with the logic you are using to setup the WebDataGrid (markup, client-side, and server-side logic). I will be happy to review the code to see and provide suggestions that may help prevent this issue from occurring.
I am looking forward to your update.
I have attached the asp.net pages associated with the grid. The grid is populated by the ucWebDataGridHelper control via the ObjectDataSource.