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
115
WebGrid not binding to templated columns when binding programmatically.
posted

I have the following page:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>
<%@ Register Assembly="Infragistics2.WebUI.UltraWebGrid.v7.2, Version=7.2.20072.1063, 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>
        <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server">
            <Bands>
                <igtbl:UltraGridBand>
                    <Columns>
                        <igtbl:UltraGridColumn IsBound="true" BaseColumnName="x">
                            <Header Caption="Test" />
                        </igtbl:UltraGridColumn>
                    </Columns>
                </igtbl:UltraGridBand>
            </Bands>
            <DisplayLayout AutoGenerateColumns="false" />
        </igtbl:UltraWebGrid>
    </div>
    </form>
</body>
</html>

 

and the following code behind:

 

Partial Public Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Me.IsPostBack Then
            Dim odtData As New DataTable()
            odtData.Columns.Add("x", GetType(Integer))
            odtData.Rows.Add(0)
            Me.UltraWebGrid1.DataSource = odtData
            Me.UltraWebGrid1.DataBind()
        End If
    End Sub

End Class

 

and when I run this I get "No Data to Display".  However, when i use a SqlDataSource and add the "DataSourceID" property to the UltraWebGrid tag instead of binding the data in the code behind, it works.  If I replace the UltraWebGrid with the basic ASP.NET DataGrid, it works.

Parents Reply Children