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
1770
Refreshing field layout every time there is a data bind
posted

My data columns are dynamic so they change based on the query parameters. The column number and/or column labels can change. They way I implemented this is by using the FieldLayoutInitialized event in the code behind.

From doing some reading the FieldLayoutInitialized event will not fire if the column types and column number is the same. The problem I'm having is this:

If a user picks calendar year for the query date range and enters in say 2011 to 2012 the column labels are' 2011' and '2012' but if they pick fiscal year the column labels change to '2011/2012' and '2012/2013' but this does not get updated in the xamdatagrid because the FieldLayoutInitialized event does not fire because I'm assuming the number and type of columns are the same as the previous field layout.

Is there a way to force the FieldLayoutInitialized event to fire every time so my field labels get updated?

Parents
No Data
Reply
  • 34510
    Offline posted

    Hi KrisVice,

    If you are assigning a new DataSource when the query is changed then what you can do is clear out the FieldLayouts collection before assigning the new DataSource.  This way when the new DataSource is assigned it won't find any FieldLayouts that match and it will create a new one triggering that event.

Children