473,772 Members | 2,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checkboxes not saving state

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="t rue"
OnCheckedChange d="chkPrice_Che ckChanged" EnableViewState ="True">

As you can see when clicked, the method 'chkPrice_Check Changed' 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_CheckC hanged 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

Aug 30 '06 #1
6 2185
Do you bind the dataGrid inside Not Page.IsPostBack or !Page.IsPostBac k
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

<ar*********@gm ail.comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.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="t rue"
OnCheckedChange d="chkPrice_Che ckChanged" EnableViewState ="True">

As you can see when clicked, the method 'chkPrice_Check Changed' 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_CheckC hanged 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

Aug 30 '06 #2
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.IsPostBac k
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

<ar*********@gm ail.comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.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="t rue"
OnCheckedChange d="chkPrice_Che ckChanged" EnableViewState ="True">

As you can see when clicked, the method 'chkPrice_Check Changed' 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_CheckC hanged 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
Aug 30 '06 #3
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
<ar*********@gm ail.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.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.IsPostBac k
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

<ar*********@g mail.comwrote in message
news:11******* **************@ b28g2000cwb.goo glegroups.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="t rue"
OnCheckedChange d="chkPrice_Che ckChanged" EnableViewState ="True">

As you can see when clicked, the method 'chkPrice_Check Changed' 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_CheckC hanged 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

Aug 30 '06 #4
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
<ar*********@gm ail.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.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.IsPostBac k
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

<ar*********@gm ail.comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.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="t rue"
OnCheckedChange d="chkPrice_Che ckChanged" EnableViewState ="True">

As you can see when clicked, the method 'chkPrice_Check Changed' 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_CheckC hanged 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
Aug 31 '06 #5
Btw im not stupid - i can spell "the" !

ar*********@gma il.com wrote:
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
<ar*********@gm ail.comwrote in message
news:11******** **************@ p79g2000cwp.goo glegroups.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.IsPostBac k
>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
>>
><ar*********@g mail.comwrote in message
>news:11******* **************@ b28g2000cwb.goo glegroups.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="t rue"
OnCheckedChange d="chkPrice_Che ckChanged" EnableViewState ="True">
>
As you can see when clicked, the method 'chkPrice_Check Changed' 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_CheckC hanged 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
>
>
Aug 31 '06 #6
The question is whether you do the bind on every page_load.

ar*********@gma il.com wrote:
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
<ar*********@g mail.comwrote in message
news:11******* *************** @p79g2000cwp.go oglegroups.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.IsPostBac k
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

<ar********* @gmail.comwrote in message
news:11***** *************** *@b28g2000cwb.g ooglegroups.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="serv er" AutoPostBack="t rue"
OnCheckedCh anged="chkPrice _CheckChanged" EnableViewState ="True">
>
As you can see when clicked, the method 'chkPrice_Check Changed' 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_CheckC hanged 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
>
Aug 31 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2833
by: DylanM | last post by:
I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the boxes and saving to the database at the end with the 'Submit' command button. Is it possible to save the changes as the checkboxes are clicked? I suppose I'd need to write some dynamic ASP event handling at the same time as creating the checkboxes......
2
2434
by: Edward | last post by:
The following html / javascript code produces a simple form with check boxes. There is also a checkbox that 'checks all' form checkboxes hotmail style: <html> <head> <title></title> </head> <body> <form name="myform" action=test.php method=post>
6
2847
by: terence.parker | last post by:
I currently have the following JS in my header: function checkall(thestate) { var checkboxes=eval("document.forms.EssayList.file_id") for (i=0;i<checkboxes.length;i++) checkboxes.checked=thestate } This works fine - but the problem is that it doesn't work with my
3
3269
by: Jimmy | last post by:
Hi I have build a datalist with checkboxes in it and after a postback the state of the checkboxes have not been saved. I have enabled the viewstate of all the controls on this page. What do I have to implement to keep the state? ch Jimmy
0
316
by: arun.hallan | last post by:
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.
10
5208
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked. I set the AutoPostBack property of the CheckBox in the Header to True & am invoking a sub named 'CheckAllRows' on the CheckedChanged event of this CheckBox. The CheckBox in the Header exists within the HeaderTemplate of a TemplateColumn in the...
12
4055
by: swebster | last post by:
I need to zero in on a specific section of my jsp form during a hide to uncheck the checkboxes in that section. Currently, anything I try either unchecks all checkboxes on the form or doesn't work at all. When I associated the specific section with ID the first box within the div is unchecked but not the second. Suggestions? <div id="menu1" class=hide> <div id="col1"> <input type="checkbox" name="Topic" value="_topic1"...
1
3771
by: colin | last post by:
Hi, I have a simple treeview, I want to put tri state checkboxes. I thought this would be standard, TreeViewNode has checkboxes, and checkboxes have tri state, but the TreeViewNode checkbox has no tri state capability. I googled for this and suepried to find this is lacking however they were mostly quite old links,
2
1153
by: AGP | last post by:
VB.NET 2005 i was reading some of the documentation on saving settings and i think i have a good grasp on things with the My.Settings classes. I understand how to bind a control to a setting and also how to save settings manually. The only thing I havent beeen able to find is how to do a massive amount of controls in one swoop. Say on my app i have 45 checkboxes and i want to save their settings (checked, enabled, etc) how would i do that...
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.