This is a migrated thread and some comments may be shown as answers.

Dynamic filter on Page_Load and Page_Init

1 Answer 115 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Damian
Top achievements
Rank 1
Damian asked on 12 Mar 2013, 01:06 AM
Hi,

 I know that RadFilter field editor can be added dynamically either on Page_Load or on Page_Init but still don't have a clear idea about its technical difference. Can anyone highlight the difference between those two?

Thanks,
Damian.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Mar 2013, 06:31 AM
Hello Damian,

There are two options for creating adding the RadFilter field editors dynamically - on Page_Load and Page_Init.

When creating a field editor in the Page_Load event handler, it should be added to the FieldEditors collection first, before its values are set. This is important because no ViewState is managed for the editor before it has been added. Also, be sure to check that IsPostBack is false. Otherwise, you will end up adding the same editors to the RadFilter multiple times.         

When creating a field editor in the Page_Init event handler, it should be added to the FieldEditors collection after its attributes are set. No ViewState is required for the editor to be persisted as it is recreated on each page initialization.         

Thanks,
Shinu.
Tags
Filter
Asked by
Damian
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or