Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Inserting dynamic rows, what event and how can I do this?
posted

For example if I want to insert a blank row after every 5th row in the grid, how do I do this?

I have tried 2 different places and neither work correctly.

If for example, I add to the InitializeRow event,

if (e.Row.Index % 5 == 0 && e.Row.Index != 0)
{
                UltraWebGrid1.Rows.Insert(new UltraGridRow(true));
}

 

but then rows 8,13,18, etc from the original list are just GONE!

 

If I try the DataBound Event

 

foreach (UltraGridRow ugr in UltraWebGrid1.Rows)
{

int index = ugr.Index;

if (index % 5 == 0 && index != 0)
{

UltraGridRow ugrHeader = new UltraGridRow(true);

UltraWebGrid1.Rows.Insert(index, ugrHeader);
}

}

It adds it to the right rows , but because the pagesize is 50, every row that is added, the grid loses those rows at the end, so for example betweenpage 1 and 2 there are rows missing!

Parents
No Data
Reply Children
No Data