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
40
Object reference not set to an instance of an object.
posted

I'm trying to use radio buttons to change the data in a WebDataGrid (Ver.=11.1.20111.2020). The data initially loads up just fine, but when the radio button is clicked I get the following error:

Server Error in '/Web' 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.Web.UI.GridControls.SummaryRow.GetSummaryValue(GridField field, Summary summary, ColumnSummaryInfo colSumInfo, SummaryRowSetting sumRowSetting, Boolean raiseEvnt) +214
   Infragistics.Web.UI.GridControls.SummaryRow.BehaviorEvents_PreRender(Object sender) +665
   Infragistics.Web.UI.GridControls.GridBehaviorEvents.OnPreRender() +22
   Infragistics.Web.UI.GridControls.GridBot.HandlePreRender() +34
   Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.OnPreRender(EventArgs e) +186
   Infragistics.Web.UI.GridControls.WebDataGrid.OnPreRender(EventArgs e) +13
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET Version:2.0.50727.5456

Here is part of my code...

Default.aspx:

<asp:RadioButtonList AutoPostBack='true' ID='rblTaskOpenClosed' RepeatDirection='Horizontal' runat='server'>
    <asp:ListItem Selected='true' Text='Open' Value='1' />
    <asp:ListItem Text='Closed' Value='0' />
    <asp:ListItem Text='Both' Value='2' />
</asp:RadioButtonList>
<ig:WebDataGrid AutoGenerateColumns='False' Height='280px' ID='grdTasks' runat='server' Width='96%'>
    <Columns>
        <ig:TemplateDataField Key='Category' Header-Text='Category' Header-Tooltip='Category'>
            <ItemTemplate>
                <asp:Label ID='lblCategory' runat='server' Text='<%#CType(Container, Infragistics.Web.UI.TemplateContainer).DataItem.TaskCategory.Description%>' />
            </ItemTemplate>
        </ig:TemplateDataField>
        <ig:TemplateDataField Header-Text='Reference' Header-Tooltip='Reference' Key='Reference' Width='30%'>
            <ItemTemplate>
                <asp:HyperLink ID='hlTaskReference' NavigateUrl='<%# String.Format("TaskForm.aspx?id={0}&ReturnURL={1}", CType(Container,Infragistics.Web.UI.TemplateContainer).DataItem.ID.ToString, Me.Request.Url.PathAndQuery) %>' runat='server' Text='<%# CType(Container,Infragistics.Web.UI.TemplateContainer).DataItem.Reference %>' />
            </ItemTemplate>
        </ig:TemplateDataField>
        <ig:TemplateDataField Key='Code' Header-Text='Code' Header-Tooltip='Code'>
            <ItemTemplate>
                <asp:Label ID='lblReference' runat='server' Text='<%#CType(Container, Infragistics.Web.UI.TemplateContainer).DataItem.Code%>' />
            </ItemTemplate>
        </ig:TemplateDataField>
        <ig:TemplateDataField Key='Date' Header-Text='Date' Header-Tooltip='Date' Width='15%'>
            <ItemTemplate>
                <asp:Label ID='lblDue_Date' runat='server' Text='<%#IIf(CType(Container, Infragistics.Web.UI.TemplateContainer).DataItem.Task_Date = "#12:00:00 AM#", String.Empty, FormatDateTime(CType(Container, Infragistics.Web.UI.TemplateContainer).DataItem.Task_Date, Microsoft.VisualBasic.DateFormat.ShortDate))%>' />
            </ItemTemplate>
        </ig:TemplateDataField>
        <ig:TemplateDataField Key='UserName' Header-Text='Assigned To' Header-Tooltip='Assigned To' Width='15%'>
            <ItemTemplate>
                <asp:HyperLink ID='hlUserName' NavigateUrl='<%# String.Format("ContactForm.aspx?id={0}&ReturnURL={1}", CType(Container,Infragistics.Web.UI.TemplateContainer).DataItem.UserID.toString, Me.Request.Url.PathAndQuery) %>' runat='server' Text='<%# CType(Container,Infragistics.Web.UI.TemplateContainer).DataItem.User.Name %>' />
            </ItemTemplate>
        </ig:TemplateDataField>
    </Columns>
    <Templates><errortemplate runat='server'>No data</errortemplate></Templates>
    <Behaviors>
        <ig:ColumnResizing />
        <ig:Paging PageSize='15' PagerAppearance='Top' PagerMode='NextPreviousFirstLast' FirstPageText='First' LastPageText='Last' NextPageText='Next' PreviousPageText='Previous' />
    </Behaviors>
</ig:WebDataGrid>

Default.aspx.vb:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    LoadTasks()
End Sub                               

Private Sub LoadTasks()
    If Contact IsNot Nothing Then
        Dim eopen As BooleanWithBoth = CType(rblTaskOpenClosed.SelectedValue, BooleanWithBoth)
        Dim colTasks As ITaskCollection = AppCon.GetAppCon.Factory.TaskCollectionLoadedByContact(Contact.ID, ITaskCollection.TaskCollectionTypes.All, eopen, BooleanWithBoth.True)
        Select Case eopen
            Case BooleanWithBoth.True
                lblTaskCount.Text = String.Format("{0} open tasks", colTasks.Count.ToString)
            Case BooleanWithBoth.False
                lblTaskCount.Text = String.Format("{0} closed tasks", colTasks.Count.ToString)
            Case BooleanWithBoth.Both
                lblTaskCount.Text = String.Format("{0} tasks", colTasks.Count.ToString)
            Case Else
        End Select
        grdTasks.DataSource = colTasks
        grdTasks.DataBind()
    End If
End Sub   

Protected Sub rblTaskOpenClosed_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rblTaskOpenClosed.SelectedIndexChanged
    LoadTasks()
End Sub

Parents Reply Children
No Data