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
589
How to get the Columncount value and set the column width
posted

We're using the Infragistics 2010.3 ASP.NET version controls and having issues in accessing the column properties (such as column count and setting a column width). 

 

We're using a datasource to build the grid data and attaching the datatable to the grid. 

 

In the ASPX page, the grid is declared as below

 

<ig:WebDataGrid ID="UGData" runat="server" Height="350px" Width="767px" />

 

In the Code Behind page, the below snippet attaches the databtable to the grid

 

        Dim dt As New DataTable()

        UGData.AutoGenerateColumns = True

        dt.Columns.Add("Column 1", Type.[GetType]("System.Double"))

        dt.Columns.Add("Column 2")

        dt.Columns.Add("Column 3")

        Dim dr As DataRow = dt.NewRow()

        For i As Integer = 1 To 5000

            dr = dt.NewRow()

            dr(0) = i

            dr(1) = DateTime.Today.AddDays(i)

            dr(2) = "Test " & i.ToString()

            dr(3) = (i Mod 2 = 0)

            dt.Rows.Add(dr)

        Next

        UGData.DataSource = dt

        UGData.DataBind()

 

For some reason, the 'UGData.Columncount' property always returns 0. Also, the I can't set the column width using 'UGData.Columns(0).Width = Unit.Pixel(100)' 

 

whats wrong?

Parents
No Data
Reply Children
No Data