Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Pb with ViewState and DataGrid


Message #1 by "Rémy MARICIC" <remind@n...> on Tue, 22 Jan 2002 17:15:30 +0100 (MET)
Hello there!

1. A short description of my pb:
I disabled the viewstate on my datagrid because i can't accept that my clients recieve a 140 ko page with 100 ko of viewstate. But
now I can't add an EditCommandColumn because the events cancel and update are not fired because of the disabled viewstate.

2 The description of what i do:

I've developped my own CustomControl that inherits from Datagrid for personal purpose.
This custom Datagrid is bounded on a dataset.
The autogeneratecolumn property is set to false and i load column programmatically at run time.
So after loading the columns of the dataset that i want to display, i load an ButtonEditColumn to edit my rows.
this Column is a DatagridColumn that inherits from ButtonColumn.
I created 3 properties EditCommandName, UpdateCommandName, and CancelCommandName to store the value of CommandName of the button.
I overrided the InitializeCell method to load an ImageButton Edit for item and 2 ImageButton Update and Cancel when its edititem.

But when in clicked on "Edit" it fires well the event and the event.commandName has the value "Edit", but when i click on "Cancel"
or "Update" the value of the event is "".
So i can't handle the event.

When i set the enableviewstate property of the datagrid to true it works fine but if i disable it, there's no event fired on the
postback.

So how can i persist the value of the 3 properties of the ButtoneditColumn so that i can fire the events on the postback ?

Thanks for answering me.

Best regards.

Remy MARICIC




  Return to Index