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
535
Recursion issue with OnAssigningFieldLayoutToItem
posted

Hi,

In my Xamdatagrid I load certain data based on click of different buttons.

When I click the button after certain steps OnAssigningFieldLayoutToItem is called. In this function I made a function call to AddDynamicColumns. This function had following code:

for(int i=0;i<fields.Count;i++)
{
if (layout.Fields.Contains(fields[i]))
{
    layout.Fields.Remove(fields[i]);
}
}

No the problem i when I load the data for the first time the code runs properly, but when I reload the loaded data in this case OnAssigningFieldLayoutToItem calls AddDynamicColumns and when this flow reaches layout.Fields.Remove(fields[i]); it again calls OnAssigningFieldLayoutToItem.

This way I am stuck in recursion between the two functions.

Kindly help.

Parents Reply Children
No Data