Dynamic TemplateColumns lose modified values on postback

P

Pop

Hello,

I have a datagrid which is being bound to a DataView who's dimensions
are unknown at design time. Specifically, I don't know how many
columns will be returned. The amount of columns returned are based on
a user's selection critiera from the page. I want to enable the
datagrid to perform multi-row edits at once. In order to do this, I
create template columns programatically, adding textbox controls
within each.

I've seen many examples that behave very similarly, except the grid is
static in dimension. (Ie the amount of Template columns can be
declared on the .aspx page and not in the code-behind).

example link: http://groups.google.ca/groups?hl=e...3788f%2439a29a80%24a101280a%40phx.gbl&rnum=17

The problem is that in PageLoad, it seems that in order to detect if
the user has modified the values in a textbox, the datagrid must be
bound in PageLoad every time. If you bind the data anywhere else (on a
buttonClick event handler) the data is rebound to the original
unmodified values -- any modifications done to the text in the
textboxes are lost.

I do not want this behaviour of having to bind the datagrid each time
in pageLoad.

Reasons:

1) The datasource of the grid is populated based on a users's
selection off of the page. On PageLoad, I still don't have access to
the user's selection (I only have acces to the dropdown
lists/textboxes they alter/choose from after a postback occured, where
I evaluate their selection from a buttonClick event handler.)

2) I don't want to bind the data each time the page loads. I only want
to bind the data to the grid on a certain button click. Other controls
on the page cause postbacks, and I don't want to bind the datagrid
based on these events.

Does anybody know of a way to do this? Greatly appreciate any help --
I've been stuck on this for days!! :(

Cheers!
 

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

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top