ViewState problem: When Composite Control Inside Custom GridView

A

Amit

Hi,

I have an issue while implementing Custom GridView control. My custom
implementation is as below:

Implementation:

I have implemented custom EnhancedGridView class inherited from “GridViewâ€
class. For this custom GridView control I want to implement Search and Paging
functionality.

To implement Search and Paging functionality, I have implemented two
separate CompositeControls as below:

EnhancedGridViewSearch : Comprises server controls like TextBox, DropDown
and Button
EnhancedGridViewPager :

I am creating above mentioned composite controls in overridden
CreateChildControls(IEnumerable dataSource, bool dataBinding) method of
EnhancedGridView class.

The expected functionality of these controls works fine but I am facing
following problem.


Issue:

After entering Search criteria in the fields of EnhancedGridViewSearch
control and if I press “Run Search†button of this control, after post back,
GridView is populated with new set of data as per the search criteria
specified, but view state of the search controls (TextBox, DropDown) in
EnhancedGridViewSearch is not maintained after post back.

I think this is the problem since CreateChildControls () method of
EnhancedGridView class is called twice first time after PostBack and second
time after GridView is bind to a new set of data.

I need some sort solution to maintain the ViewState of child controls of
Composite Controls that are built inside GridView class.

I am desperately seeking help for this issue.
Please share your thoughts if you have something.

Thanks in Advance
Regards
Amit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top