473,788 Members | 3,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

will checkboxes lose their state after postback?

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
Nov 19 '05 #1
3 3269
Are these checkboxes bound to a data source? If so, have you updated the
data source in the postback and re-bound the datalist to the data source?
"Jimmy" <be****@gmail.c om> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
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

Nov 19 '05 #2
Scott
They are not bound to a datasource...
In this case the viewstate does not take care of this? So I have to write
code to put the values of the (un)checked boxes back?

Ch Jimmy
"Scott M." <s-***@nospam.nosp am> wrote in message
news:Ob******** *****@TK2MSFTNG P10.phx.gbl...
Are these checkboxes bound to a data source? If so, have you updated the
data source in the postback and re-bound the datalist to the data source?
"Jimmy" <be****@gmail.c om> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
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


Nov 19 '05 #3
Yes, you seems to have to override the SaveViewstate and LoadViewstate
method in order to reload the value.

..NET framwork will not take care of them because to the framwork, they are
essentially something recreated(i.e.: they are not the origional checkboxes
after postback, they're just another group of checkboxes that process the
same ID as the destroyed ones)

"Jimmy" <be****@gmail.c om> ¼¶¼g©ó¶l¥ó·s»D: OB************* *@TK2MSFTNGP12. phx.gbl...
Scott
They are not bound to a datasource...
In this case the viewstate does not take care of this? So I have to write
code to put the values of the (un)checked boxes back?

Ch Jimmy
"Scott M." <s-***@nospam.nosp am> wrote in message
news:Ob******** *****@TK2MSFTNG P10.phx.gbl...
Are these checkboxes bound to a data source? If so, have you updated the
data source in the postback and re-bound the datalist to the data source?
"Jimmy" <be****@gmail.c om> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
> 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
>
>



Nov 19 '05 #4

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

Similar topics

6
2849
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
2
1582
by: Glenn Owens | last post by:
Can someone please explain the rationale behind not putting a checkbox reference into the postback data collection? I have a composite control (supporting IPostBackDataHandler) which populates a DataGrid with dynamic controls (textboxes, labels, dropdownlists, etc). Until I started to implement support for checkboxes all of the previous controls are always represented/available in the postback data collection. - not checkboxes.
7
2421
by: DJ Dev | last post by:
Hi All, I have a complex problem. I have dropdownlists (usually 3-5) and the user selects some value from these and for each value selected, datagrids are shown to the user. I am creating the Datagrids dynamically using a loop depending on the number of Dropdownlists. The datagrids also have a checkbox template column. Now my problem is that how can I access the values selected by the user from these checkboxes. He checks one or more...
4
2408
by: epigram | last post by:
I've got a page that has a Panel object that I am dynamically adding CheckBox controls to. The number of CheckBox controls and the name of each control is based on a database query. I would like to know how I can query for all the CheckBox controls on the page during postback and check their checked attribute without using the name of each checkbox. I want to do this in a generic way so that I don't have to requery the db or save the...
4
1952
by: Jim Bancroft | last post by:
Hi everyone, I'm using a DataGrid with TemplateColumns. My DataGrid is located in a cell of an asp:Table. I did this so it's positioned correctly onscreen. One of the DataGrid's TemplateColumns is a checkbox. During the page's postback I loop over the DataGrid and read the checkbox values. My problem is, none of the checkboxes ever have their "Checked" attribute set-- it's as though anything I mark is ignored.
2
2015
by: Tomas Martinez | last post by:
Hi, Well, my problem is so simple as it says in the subjet but very frustrating also. I have a project and it is losing the session variables with each postback, so I downloaded from the web a project which used a session management dll to discover what was wrong in my project. This web project has two pages, one send to the other a variable with session state and the other changes this one, shown in a label, with each postback, well,...
8
1996
by: mark.norgate | last post by:
I've asked this question before, but still haven't solved it, so am asking again. I am programmatically adding a user control to the page in response to a button click. The user control consists of three dropdowns and seven text boxes. When the button is clicked, I add another control to the page in Click event of the button and populate the three dropdowns. The text boxes are to be populated by the user.
6
2186
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.
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,
0
9655
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
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
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
5398
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
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.