One of the columns in our grid has wrapped text. So we set AutoSizeRows = True so that the row height automatically resizes to fit the multiple lines as needed.
However, this causes another problem when adding new lines. When the user clicks our Add button and we add a row to the grid, the row is only a few pixels tall. The user cannot enter data because the row is way too small.
We tried hard-coding in a height for the row after adding the row, and this works temporarily. But if the user wants to add four rows only the last row retains its height.
Is there some way to set a minimum or default row size so we can leave AutoSizeRows set to try and still have an Add feature?
Thanks!
However, this causes another problem when adding new lines. When the user clicks our Add button and we add a row to the grid, the row is only a few pixels tall. The user cannot enter data because the row is way too small.
We tried hard-coding in a height for the row after adding the row, and this works temporarily. But if the user wants to add four rows only the last row retains its height.
Is there some way to set a minimum or default row size so we can leave AutoSizeRows set to try and still have an Add feature?
Thanks!
6 Answers, 1 is accepted
0

Emanuel Varga
Top achievements
Rank 1
answered on 15 Oct 2010, 05:17 PM
Hello Deborah,
In order to change the size of the NewRowElement, you can register to the ViewRowFormatting event, check for GridNewRowElement and set the Height to a minimum acceptable value:
OR, if you don't want to always have a big, you should be able to just change the height of the row, in the CellBeginEdit event:
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
In order to change the size of the NewRowElement, you can register to the ViewRowFormatting event, check for GridNewRowElement and set the Height to a minimum acceptable value:
radGridView1.ViewRowFormatting +=
new
RowFormattingEventHandler(radGridView1_ViewRowFormatting);
void
radGridView1_ViewRowFormatting(
object
sender, RowFormattingEventArgs e)
{
var newRow = e.RowElement
as
GridNewRowElement;
if
(newRow !=
null
)
{
newRow.RowInfo.Height = 100;
}
}
OR, if you don't want to always have a big, you should be able to just change the height of the row, in the CellBeginEdit event:
void
radGridView1_CellBeginEdit(
object
sender, GridViewCellCancelEventArgs e)
{
if
(e.RowIndex == -1)
{
radGridView1.CurrentRow.Height = 50;
}
}
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
0
Accepted
Hello Deborah,
Thank you for contacting us.
Yes, setting a minimum height for grid rows is possible. You should set the MinHeight property of the row when handling the ViewRowFormatting event. Here is a sample:
I hope this helps.
Kind regards, Jack
the Telerik team
Thank you for contacting us.
Yes, setting a minimum height for grid rows is possible. You should set the MinHeight property of the row when handling the ViewRowFormatting event. Here is a sample:
void
radGridView1_ViewRowFormatting(
object
sender, RowFormattingEventArgs e)
{
e.RowElement.RowInfo.MinHeight = 40;
}
I hope this helps.
Kind regards, Jack
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Deborah
Top achievements
Rank 1
answered on 15 Oct 2010, 05:24 PM
Is there a way to just set it for the grid so I don't have to add this code to each of my 40 forms?
I have a routine that each of my forms calls to set the standard properties for the grid so that all of the grids on all of my forms behave the same. Is there anyway I can set in there?
Thanks!
I have a routine that each of my forms calls to set the standard properties for the grid so that all of the grids on all of my forms behave the same. Is there anyway I can set in there?
Thanks!
0
Accepted

Emanuel Varga
Top achievements
Rank 1
answered on 15 Oct 2010, 05:30 PM
Hello again, no, you cannot do this from the designer, but I would suggest a custom grid control, inherited from the RadGridView with the necessary changes
Best Regards,
Emanuel Varga
0

Deborah
Top achievements
Rank 1
answered on 16 Oct 2010, 04:28 PM
I started to do as you suggested and build my own custom control from the GridView. However, I immediately lost the theme I was using.
Do you have an example of how to correctly build a custom control from the GridView without losing some of its key functionality?
I checked the knowledge base and did not see any specific topics covering how to build a custom control from your controls.
Thanks!
Do you have an example of how to correctly build a custom control from the GridView without losing some of its key functionality?
I checked the knowledge base and did not see any specific topics covering how to build a custom control from your controls.
Thanks!
0

Emanuel Varga
Top achievements
Rank 1
answered on 16 Oct 2010, 05:03 PM
Hello Deborah,
You have to override the ThemeClassName property for the theme to be applied on the custom grid Control:
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
You have to override the ThemeClassName property for the theme to be applied on the custom grid Control:
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadGridView).FullName;
}
}
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga