Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Can't bind column to external control when grid created in code

Last post 07-09-2008 10:47 by [Infragistics] Sung Kim. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-03-2008 16:29

    • thutt
    • Not Ranked
    • Joined on 05-29-2008
    • Points 140

    Can't bind column to external control when grid created in code

    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

    • Post Points: 20
  • 07-09-2008 10:47 In reply to

    Re: Can't bind column to external control when grid created in code

    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

    • Post Points: 5
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems