Checkboxes not saving state

  • Thread starter Thread starter arun.hallan
  • Start date Start date
A

arun.hallan

Hi,

I have a datagrid whose datasource is a datatable which is saved to
viewstate on page_load.

I also have a cached string which handles what is shown on the
rowfilter of the dataview of this datatable.

I also have a cached string that holds the way the dataview is sorted.

Now, on my original datagrid i have a row of checkboxes added from the
property builder. The HTML behind it is : <asp:CheckBox id="chkPrice"
runat="server" AutoPostBack="true"
OnCheckedChanged="chkPrice_CheckChanged" EnableViewState="True">

As you can see when clicked, the method 'chkPrice_CheckChanged' is
meant to be called. However i dont think it is being called. I know i
it doesnt hit my breakpoint when i put one in.

The chkPrice_CheckChanged is meant to save all the checkbox values to a
hashtable so on the next page_load, the checkboxes can be filled again.

Does anyone know why this method isnt called, and/or provide some light
to the situation.

Thanks,
Arun
 
Do you bind the dataGrid inside Not Page.IsPostBack or !Page.IsPostBack
check so that accidental rebind on postback wouldn't "eat up" the events.
 
I bind on page_load...

The datasource of teh datagrid is a datatable.
That is cached.

The 'datasource' for the checkboxes is a hashtable. When a box is
checked, i want to update the hashtable and save it to the cache.

But the event to do this doesnt fire.
 
On !postback the datagrid is filled with data from the database.

Then teh datatable from this datagrid is saved into viewstate.

On postback, teh datatable from viewstate is binded back to the
datagrid.

Is this not how i should do it?
 
Btw im not stupid - i can spell "the" !

On !postback the datagrid is filled with data from the database.

Then teh datatable from this datagrid is saved into viewstate.

On postback, teh datatable from viewstate is binded back to the
datagrid.

Is this not how i should do it?
 
Back
Top