Only returning one checkbox on postback

This is a discussion on "Only returning one checkbox on postback" within the ASP.NET Forum section. This forum, and the thread "Only returning one checkbox on postback are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > ASP.NET Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 26th, 2003, 20:51
New Member
Join Date: Sep 2003
Location: Canada
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Only returning one checkbox on postback

Hi folks, I have a problem with checkboxes.
I am only able to repopulate the firstcheckbox.
For example:
Pets:
Dog
Reptiles
Fish
Birds
Cat

If I select dog and reptiles and do a post back I only get dog checked. Here is my code: private void cblPets_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (cblPets.SelectedItem != null)
{
Session["webform6_cblPets] =
cblPets.SelectedValue;
}
}


private void Page_Load(object sender, System.EventArgs e)
{

if (!IsPostBack)
// Evals true first time browser hits
the page
{
FillcblPets(PetsList);
} // !PostBack

} // PageLoad







private void FillcblPets(DataView data)
{
this.cblPets.DataSource = data;
this.cblPets.DataMember = "title";
this.cblPets.DataTextField = "text";
this.cblPets.DataValueField = "value";
this.cblPets.DataBind();
// restore the selected title (if a user had
already selected a title on a previous page session)
if (Session["webform6_cblPets] !=null)
{
foreach (ListItem item in
this.cblPets.Items)
{
if (item.Value == Session
["webform6_cblPets].ToString())
{

this.cblPets.SelectedIndex = this.cblPets.Items.IndexOf(item);
}
}

}

}


// property delivers the list of Pets
private DataView PetsList
{
get
{
DataSet myDataSet = new DataSet ();

myDataSet.ReadXml(Server.MapPath("PersonalInterest s/Pets.xml"));
return
(myDataSet.Tables["pets].DefaultView);
}
}


I would appreciate if someone could get back to me ASAP.
Take care.

Closed Thread

Tags
returning, checkbox, postback

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning ajax data kenoli JavaScript Forum 1 Aug 21st, 2007 11:27
Returning a value from a MYSQL Query? Kimochi PHP Forum 7 Feb 28th, 2007 20:09
Returning results into a table with no repeat of data lobster1983 PHP Forum 7 Sep 24th, 2005 20:23
Returning result from db as a hyperlink lobster1983 PHP Forum 2 Sep 18th, 2005 19:59
Problem returning results into table lobster1983 PHP Forum 2 Sep 15th, 2005 21:40


All times are GMT. The time now is 00:10.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43