Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Ultrawebgrid Column Filter : Error System.NullReferenceException
posted

Hi

My application developed using .net framework 4.0 and NetAdvantage for .NET 2008 Vol. 2 CLR 2.0.Im having a ultrawebgrid.In that Im having one template column which is check box column as below

<Columns>
<igtbl:TemplatedColumn Width="15%" BaseColumnName="" Key="SelectAll" AllowResize="Fixed" FilterIcon="False" AllowRowFiltering="false" SortIndicator="None" AllowUpdate="No">
<HeaderTemplate>
<div>
<asp:CheckBox ID="chkItemHeader" Text="Select All" runat="server" onclick="HeaderCheckBoxItemClick(this,'gridDEF','SelectAll')" />
</div>
</HeaderTemplate>
<CellTemplate>
<asp:CheckBox ID="chkItemSelect" CausesValidation="false" onclick="CheckBoxItemClick(this,'gridDEF','SelectAll')" runat="server" />
</CellTemplate>
</igtbl:TemplatedColumn>
</Columns>

and rest all other populate from db at run time.I have kept column filter for each column.Each column filter values will be derived at grid initialize layout event by taking the grid' s datasource and looping through the columns and taking distinct values of each column and adding that into filtervalue collection
of that column.

User will select a row by checking the checkbox in each row.Whenever user clicks on checkbox Im changing the row color and updating a particular cell value as 1 using the below javascript

function CheckBoxItemClick(ChkObj, _GridName, ColKey) {
        //debugger;

        var _grid;
        if (_GridName == 'gridDEF')
            _grid = igtbl_getGridById('<%=gridDEF.ClientID%>');
        else if (_GridName == 'gridDES')
            _grid = igtbl_getGridById('<%=gridDES.ClientID%>');
     
        var _row = _grid.getActiveRow();

        for (i = 0; i < _grid.Rows.length; i++) {

            if (ChkObj.checked == true) {
                _row.getCell(1).setValue("1");
                _row.Element.runtimeStyle.backgroundColor = "#EFD7C6";
            }
            else {
                _row.getCell(1).setValue("0");
                _row.Element.runtimeStyle.backgroundColor = "white";
            }

        }
   }

Suppose if the user selects the row by above and then apply column filter,the application throws an error which is not getting caught in our user defined exception log.If I put debugger its not goin to any of our code block.After all our code block completed its just moving to the error page.

The error description is as below.

Server Error in '/' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   Infragistics.WebUI.UltraWebGrid.UltraWebGrid.UpdateDBRow(UltraGridRow row, UltraGridRow oldRow) +155
   Infragistics.WebUI.UltraWebGrid.UltraWebGrid.ProcessChanges(StateChanges stateChanges, Boolean fireEvents) +1588
   Infragistics.WebUI.UltraWebGrid.UltraWebGrid.RaisePostDataChangedEvent() +161
   System.Web.UI.Page.RaiseChangedEvents() +134
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5201

Need your help to sort this out. 

Thanks in Advance