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

Set row height in dynamic RadGrid

2 Answers 568 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 12 Jun 2013, 03:22 PM
I'm still new to Telerik and .net, So pardon me if this is trivial.
I have a problem with a dynamically built Rad Grid.

It loads just fine but I had a problem where I need to maintain leading white space in
a note text field (it's 50 char data string used to print on forms). 
I found a few ideas to try and fix but the only one that worked for me was to use
the DataFormatString.

Now the problem is when I do this formatting, my row height has almost doubled
in size.  How can I set the row height and still keep the preformatted text from dropping
the leading white space. Any input would be great.

Dim rgOrderNotes As New RadGrid

rgOrderNotes.ID = "rgOrderNotes"

rgOrderNotes.Style("Position") = "Absolute"

rgOrderNotes.Style("Top") = (150).ToString & "px"

rgOrderNotes.Style("Left") = (50).ToString & "px"

rgOrderNotes.Visible = True

rgOrderNotes.AutoGenerateColumns = False

rgOrderNotes.Height = 500

rgOrderNotes.PageSize = 18

rgOrderNotes.ClientSettings.Scrolling.AllowScroll = True

rgOrderNotes.AllowAutomaticInserts = True

rgOrderNotes.AllowAutomaticUpdates = True

 

Dim boundColumn As GridBoundColumn

boundColumn = New GridBoundColumn()

boundColumn.DataField = "O5ITEM"

boundColumn.HeaderText = "LINE #"

boundColumn.HeaderStyle.Width = Unit.Pixel(120)

rgOrderNotes.MasterTableView.Columns.Add(boundColumn)

boundColumn = New GridBoundColumn()

boundColumn.DataField = "ODTEXT"

boundColumn.HeaderText = "NOTE DESCRIPTION"

boundColumn.ItemStyle.Font.Name = "Courier New"

boundColumn.DataFormatString = "<pre>{0}</pre>"

boundColumn.HeaderStyle.Width = Unit.Pixel(400)

rgOrderNotes.MasterTableView.Columns.Add(boundColumn)


 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jun 2013, 04:07 AM
Hi,

I am not sure about your requirement. I guess since the RadGrid height is fixed to 500px and increasing the row height is causing the problem. Try setting the height of the RadGrid to 'auto'. Here is an another way to set the row height.

VB:
boundColumn.ItemStyle.Height = Unit.Pixel(120)

Thanks,
Shinu.

0
Todd
Top achievements
Rank 1
answered on 13 Jun 2013, 08:33 PM
Made your changes and still no luck. It looks like it has to do with the <pre>.
If I remove that it works fine but I lose the leading white space. I put it back in and
I get extra high rows in the grid. I even tried something else I found in a forum.
 <style type="text/css">
.rgExpandCol

height:16px !important 
}
.rgRow

height:16px !important 
}
.rgAltRow

height:16px !important 
}
</style>

None of these worked with the <pre> either.

Any other Ideas on how I can preserve the leading white space?
This will be then uploaded to a DB2 database on our i-Series and need the 
alignment for forms printing.
Thanks again.
Tags
Grid
Asked by
Todd
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Todd
Top achievements
Rank 1
Share this question
or