Velocity Reviews

Velocity Reviews (
-   ASP .Net (
-   -   Dynamically Adding Boundfields + Sorting (

ami 04-25-2007 06:15 PM

Dynamically Adding Boundfields + Sorting
Hi everyone,

I have a question about dynamically adding columns to a gridview.

Based on user input (after a button click), some columns are being
added to my gridview.

What I do:

OnButtonClick: I call a method that adds the new boundfield
columns(addColumns). After that, it calls databind on the gridview.
This works fine.

However, when I sort a column, the newly added columns disappear. I
am assuming this is because my method to add the columns is in the
ButtonClick event and is getting lost on the new databinding.

My question is - where do I call my addColumns method for sorting?
How do I modify the OnSorting event to call this method and then do
the sorting correctly? Currently, I have not implemented the
OnSorting event. I have just turned sorting on in the gridview and am
letting the gridview take care of it.

In addition, am I calling my addColumns method in the correct place
after the user button click? It can't be called from the OnDataBound
event - this just causes the gridview to be databound repeatedly.

Thanks for any help you can provide!

All times are GMT. The time now is 03:19 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.