I would like to know if it is possible to complete a gridview with empty rows?
For example, I have a grid view which can contain 9 rows but I only have 3 items to show.
The bottom of my grid is empty and I'd prefer having empty rows than nothing!
How can I do this?
Thanks
Lookoum
3 Answers, 1 is accepted
0
Julian Benkov
Telerik team
answered on 02 Dec 2011, 05:02 PM
Hello Laffargue,
For this scenario you can use RadGridView in unbound mode. Set you number of rows and columns and fill only rows that must contain values. Here is a simple example:
radGridView1.RowCount = 9;
radGridView1.ColumnCount = 5;
for(inti = 0; i < 3; i++)
{
for(intj = 0; j < radGridView1.ColumnCount; j++)
{
radGridView1.Rows[i].Cells[j].Value = "MyValue";
}
}
I hope this helps. Let me know if you need further assistance.
Thanks for your answer but my RadGridView is filled by my database.
I used the FiledName properties in order to bind values.
Isn't it posssible to complete the grid automatically?
I think maybe there's a problem when I group my data by a column.
I would like to complete my grid cause I use the alternatingrowscolors properties (blue and gray) and I don't want to see some blank on the bottom of the grid if this one is not complete.
Thank you.
Lookoum
0
Julian Benkov
Telerik team
answered on 08 Dec 2011, 10:05 AM
Hello Laffargue,
I understand your requirements. The RadGridView control does not support this functionality - to mix bound and unbound rows to render alternating row colors. The solution in this situation is to add dummy empty rows in your data source, but the synchronization will be more complex if you apply sorting, filtering, grouping operations.
Do not hesitate to contact us if you have further questions or issues.