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:
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.
[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
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 IfEnd Sub Protected Sub rblTaskOpenClosed_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rblTaskOpenClosed.SelectedIndexChanged LoadTasks()End Sub
Hi wvusaf,
As I had said, I need a running sample to properly debug this and find where and why the exception is ocuring. If you can help me with that, that would be great.
regards,
Andrew Young
I am getting the same exact error. Happens when I try to page or click on a LinkButton in a Template Column.
This leaves the WebDataGrid unusable and this control is one of the reasons we purchased the Infragistics tool suite.
What can I do to fix this?
Well, I'm getting that error even when I click on a radio button that doesn't change the data for the WebDataGrid at all (it changes the visible settings for several textbox controls). I tried ClearDataSource() just to see if that would help and it didn't.If I upgrade (if that's possible) and I still get an error, I'll see if I can build a running sample to upload.
Hi,
So long as your data sources you supply has the same schema, you shouldn't have to call ClearDataSource() on the grid before applying the new one. One thing I can suggest is to upgrade to the latest service release. I know which method you are getting the exception in, but without a running sample, it is impossible to identify the actual problem.
regards,David Young