Home All Groups Group Topic Archive Search About

Checkboxes not saving state

Author
30 Aug 2006 3:56 PM
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

Author
30 Aug 2006 4:55 PM
Teemu Keiski
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.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

<arun.hal***@gmail.com> wrote in message
Show quote
news:1156953362.031002.63920@b28g2000cwb.googlegroups.com...
> 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
>
Author
30 Aug 2006 5:01 PM
arun.hallan
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.


Teemu Keiski wrote:

Show quote
> 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.
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
>
> <arun.hal***@gmail.com> wrote in message
> news:1156953362.031002.63920@b28g2000cwb.googlegroups.com...
> > 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
> >
Author
30 Aug 2006 7:03 PM
Teemu Keiski
Yup, but in the Page_Load you do it inside If Not Page.IsPostBack check so
that it wouldn't get databound on every request, that's the question? That
will prevent events from firing.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


<arun.hal***@gmail.com> wrote in message
Show quote
news:1156957311.421623.100230@p79g2000cwp.googlegroups.com...
>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.
>
>
> Teemu Keiski wrote:
>
>> 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.
>>
>> --
>> Teemu Keiski
>> ASP.NET MVP, AspInsider
>> Finland, EU
>> http://blogs.aspadvice.com/joteke
>>
>> <arun.hal***@gmail.com> wrote in message
>> news:1156953362.031002.63920@b28g2000cwb.googlegroups.com...
>> > 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
>> >
>
Author
31 Aug 2006 8:37 AM
arun.hallan
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?

Teemu Keiski wrote:

Show quote
> Yup, but in the Page_Load you do it inside If Not Page.IsPostBack check so
> that it wouldn't get databound on every request, that's the question? That
> will prevent events from firing.
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
>
>
> <arun.hal***@gmail.com> wrote in message
> news:1156957311.421623.100230@p79g2000cwp.googlegroups.com...
> >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.
> >
> >
> > Teemu Keiski wrote:
> >
> >> 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.
> >>
> >> --
> >> Teemu Keiski
> >> ASP.NET MVP, AspInsider
> >> Finland, EU
> >> http://blogs.aspadvice.com/joteke
> >>
> >> <arun.hal***@gmail.com> wrote in message
> >> news:1156953362.031002.63920@b28g2000cwb.googlegroups.com...
> >> > 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
> >> >
> >
Author
31 Aug 2006 9:01 AM
arun.hallan
Btw im not stupid - i can spell "the" !

arun.hal***@gmail.com wrote:

Show quote
> 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?
>
> Teemu Keiski wrote:
>
> > Yup, but in the Page_Load you do it inside If Not Page.IsPostBack check so
> > that it wouldn't get databound on every request, that's the question? That
> > will prevent events from firing.
> >
> > --
> > Teemu Keiski
> > ASP.NET MVP, AspInsider
> > Finland, EU
> > http://blogs.aspadvice.com/joteke
> >
> >
> > <arun.hal***@gmail.com> wrote in message
> > news:1156957311.421623.100230@p79g2000cwp.googlegroups.com...
> > >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.
> > >
> > >
> > > Teemu Keiski wrote:
> > >
> > >> 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.
> > >>
> > >> --
> > >> Teemu Keiski
> > >> ASP.NET MVP, AspInsider
> > >> Finland, EU
> > >> http://blogs.aspadvice.com/joteke
> > >>
> > >> <arun.hal***@gmail.com> wrote in message
> > >> news:1156953362.031002.63920@b28g2000cwb.googlegroups.com...
> > >> > 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
> > >> >
> > >
Author
31 Aug 2006 11:56 AM
Ray Booysen
The question is whether you do the bind on every page_load.

arun.hal***@gmail.com wrote:
Show quote
> 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?
>
> Teemu Keiski wrote:
>
>> Yup, but in the Page_Load you do it inside If Not Page.IsPostBack check so
>> that it wouldn't get databound on every request, that's the question? That
>> will prevent events from firing.
>>
>> --
>> Teemu Keiski
>> ASP.NET MVP, AspInsider
>> Finland, EU
>> http://blogs.aspadvice.com/joteke
>>
>>
>> <arun.hal***@gmail.com> wrote in message
>> news:1156957311.421623.100230@p79g2000cwp.googlegroups.com...
>>> 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.
>>>
>>>
>>> Teemu Keiski wrote:
>>>
>>>> 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.
>>>>
>>>> --
>>>> Teemu Keiski
>>>> ASP.NET MVP, AspInsider
>>>> Finland, EU
>>>> http://blogs.aspadvice.com/joteke
>>>>
>>>> <arun.hal***@gmail.com> wrote in message
>>>> news:1156953362.031002.63920@b28g2000cwb.googlegroups.com...
>>>>> 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
>>>>>
>

AddThis Social Bookmark Button