Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 20th, 2007, 12:30 AM
Registered User
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kaushikpulpa
Default Check BOx

There are multiple pages . On each page dynamic checkboxes. I check some checkboxes on first page i go to next page & check 2 more checkboxes . so when i return back to first page the checked checkboxes becomes unchecked. So how do i avoid this ?

with thans and regards,
Kaushik Chandra Pulpa
Old August 20th, 2007, 08:27 AM
Friend of Wrox
Join Date: May 2006
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts

Add some code so that when a check box is ticked set a variable.
On return to the page if the variable is set then fill in the tick on the page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   If Session("CheckBox1IsChecked") = "Y" Then
     CheckBox1.Checked = True
   End If
End Sub

Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
    If CheckBox1.Checked = True Then
       Session("CheckBox1IsChecked") = "Y"
    End If
End Sub

Make sure that to start with the Session("CheckBox1IsChecked") is set to something other than "Y"

Old August 30th, 2007, 08:01 AM
Authorized User
Join Date: Aug 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

hi kaushik,
this is Shakti.

just set the viewstate property of that checkbox to true,
now every time the page goes to server the state of that control is maintained in its viewstate property.
so no need to write any code.

reply ur comments.

Similar Threads
Thread Thread Starter Forum Replies Last Post
check box help? dstein4d Access VBA 2 February 27th, 2008 09:54 AM
VBA - Check box KennethMungwira Access VBA 2 May 22nd, 2006 10:43 AM
please help (get check box value) qadeerahmad General .NET 3 September 24th, 2004 08:46 AM
Check box Error surendran BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 July 25th, 2004 11:36 PM
how to get value from check box..... cici Classic ASP Professional 2 May 15th, 2004 08:35 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.