tags:

views:

163

answers:

0

I have been experimenting with adding some filters to a gridview header row.

If the dropdowns are on the page, everything works fine.

Moving them into the grid has introduced so many problems its shocking. The drop downs are bound to data at runtime as the data in them is dynamic. These values are set only on the initial load and retained on post backs. Once in the grid this no longer works, the values are lost on postback.

The grid itself is bound to an objectdatasource that uses the dropdowns values as parameters. The source can no longer find the controls so I have manually inserted the parameters in the selecting event of the datasource, unfortunately the gridview row header is not yet created so I cannot get the values. So on initial load I default to 'all'. Unfortunately the code at this point starts to look scrappy and there is more hoops to jump.

So the dropdown is not remembering its data, not remembering its last selected index so on every post its selected all again.

So i've gone back to the old layout and now I want a nice smart way to achieve the effect of making the drop downs only appear to be in the header of the grid.

Or does someone know that i'm making a dumb mistake? Like a property on the grid not set correctly?

Cheers