Although I have no problem binding WebDateTimeEdit control to a column when the grid was declared in the HTML, the same code throws a null exception on the .EditControlID reference when the grid was built in code. The value of the .EditControlID property is nothing at the time the exception is thrown. I'm using version 6.2. Here is a simple HTML/VB example. Am I missing something?
Thanks
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" Theme="Site"%><%@ Register Assembly="Infragistics2.WebUI.WebDataInput.v6.2, Version=6.2.20062.1060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.WebDataInput" TagPrefix="igtxt" %><%@ Register Assembly="Infragistics2.WebUI.UltraWebGrid.v6.2, Version=6.2.20062.1060, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebGrid" TagPrefix="igtbl" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div runat="server" id="divTest"/> <igtxt:WebDateTimeEdit ID="WebDateTimeEdit1" runat="server"/> </form></body></html>--------------------------------------------------------------------------------------------------------------
Imports Infragistics.WebUI.UltraWebGridPartial Class TestInherits System.Web.UI.PageProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Using oUWG As New UltraWebGrid("uwgTest") oUWG.DisplayLayout.AllowUpdateDefault = AllowUpdate.Yes oUWG.Columns.Add("TEST", "TEST") With oUWG.Columns.FromKey("TEST") .Width = New Unit("100%") .Type = ColumnType.Custom .EditorControlID = WebDateTimeEdit1.UniqueID 'Object reference not set to an instance of an object' exception thrown here End With oUWG.Rows.Add() Dim oUWGRow As UltraGridRow = oUWG.Rows(oUWG.Rows.Count - 1) oUWGRow.Cells.FromKey("TEST").Value = "1/1/2000" oUWGRow = Nothing divTest.Controls.Add(oUWG) End UsingEnd SubEnd Class
Try moving the line of code that is causing the problem to the very end. It may be hitting that exception due to there being no data when the editor is being assigned. If anything you may want to also submit this issue to our support team so that they may look into if this is expected behavior or indeed a bug.
http://devcenter.infragistics.com/Protected/SubmitSupportIssue.aspx