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

[Solved] Adjust edit form column width

4 Answers 258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 11 Mar 2008, 12:58 PM
Is it possible to adjust the width of the columns in the Prometheus Grid control?

Currently it seems to default to a fixed width and I'm not sure of the best way to increase or decrease this width as I would like?

4 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 13 Mar 2008, 02:13 PM
Hi Marc,

You can set the widths for the individual columns (ItemStyle/HeaderStyle tags), declaratively in the .aspx code, from the code-behind or on the client. If the columns are autogenerated you can also use the columnCreated event handler, or alternatively use the PreRender event handler, and iterate through all the rendered columns (RadGrid1.MasterTableView.RenderColumns).

All the best,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Andy
Top achievements
Rank 1
answered on 26 Mar 2008, 09:44 AM
Sorry I've only just got round to this however I realised I made a small mistake in my post and forgot the mention that this is the width of the columns in the edit form when using an autogenerated EditForm and not the width of the columns in the grid control itself.

What I mean by this is when the user clicks the edit button the grid brings up the edit form showing the columns which can have their contents edited.  By default it puts all these controls into one long column list (I know how to add extra columns if needed)  but only give the columns a fixed width.  I would like the edit column to take up 100% of the available width....

Thanks,

Marc
0
Yavor
Telerik team
answered on 26 Mar 2008, 02:25 PM
Hi Marc,

In this case, you may consider using a form template edit form, which would give you more flexibility over the visual layout of the control's edit form.
I hope this is a suitable option for you.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Steele
Top achievements
Rank 1
answered on 01 Apr 2008, 06:30 PM
I fugured out parts of it...
It would be nice if we could just make a single setting to change the width of he Autogenerated Form instead of have to dig quite this deep...

Private Sub gridPayments_CreateColumnEditor(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCreateColumnEditorEventArgs) Handles gridPayments.CreateColumnEditor

If e.Column.UniqueName = "comments" Then

If TypeOf e.ColumnEditor Is GridTextBoxColumnEditor Then

Dim tb = DirectCast(e.ColumnEditor, GridTextBoxColumnEditor)

With tb.TextBoxControl

.TextMode = TextBoxMode.MultiLine

.Rows = 5

.Width = Unit.Pixel(600)

End With

End If

End If

End Sub

I would still rather set it as a percentage, but doing so will only fill to the table and I could not dig around long enough to find out how to reference it.  Setting it to a Pixel Unit will expand the table so I suppose one way around this is to set any control to a fixed size and the rest to a percentage...  I will dig around more on this later.

Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Andy
Top achievements
Rank 1
Steele
Top achievements
Rank 1
Share this question
or