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
155
Can't bind column to external control when grid created in code
posted

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.UltraWebGrid
Partial Class Test
Inherits System.Web.UI.Page
Protected 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 Using
End Sub
End
Class