This is a migrated thread and some comments may be shown as answers.

[Solved] Dynamic GridBoundColumn Width In Design Time Renders Differently At Runtime

1 Answer 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Virgil Rodriguez
Top achievements
Rank 1
Virgil Rodriguez asked on 26 Apr 2013, 03:01 PM
Hello Telerik,

My Apologies, the thread title should read:

Dynamic GridBoundColumn Width During Development Time Renders Differently When Deployed To Web Server

I'm at a loss here. I have a static RadGrid "rgEventQuery". I successfully create the columns for this RadGrid dynamically and I also dynamically change the width of any of these columns. What I can't understand is why the width of these dynamic columns appears different when the grid is displayed during development time than when it is deployed to the web server.

The property I'm changing is the HeaderStyle.Width property. Below are some code snippets: 

fld = "DEPARTMENT"
fldWidth = "55:T"
gbc =
New GridBoundColumn
gbc.DataField = fld
rgEventQuery.MasterTableView.Columns.Add(gbc)
gbc.UniqueName = fld
gbc.SortExpression = fld
gbc.HeaderButtonType = GridHeaderButtonType.LinkButton
If fldWidth <> "" Then
    If fldWidth.Contains(":") Then
        If IsNumeric(fldWidth.Split(":")(0)) Then
            gbc.HeaderStyle.Width = fldWidth.Split(":")(0)
        End If
    Else
        If IsNumeric(fldWidth) Then
            gbc.HeaderStyle.Width = fldWidth.Split(":")(0)
        End If
    End If
End If
gbc.AllowSorting = True
rgEventQuery.MasterTableView.SortExpressions.AddSortExpression(gbc.SortExpression)


If you could create a sample website (that works on your end) that I can test on my end, that would be greatly appreciated.

Thank you.

Virgil

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 01 May 2013, 07:02 AM
Hello Virgil,

Note that HeaderStyle.Width property is of type Unit and you have to set it with a correct value. I am attaching a small runnable sample that runs as expected on my side and demonstrates how to set the value correctly

I hope this helps.

Greetings,
Martin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Virgil Rodriguez
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or