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.
|
|
|
|
|
![]() |
||
Only returning one checkbox on postback
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
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. |
|
|
![]() |
| Tags |
| returning, checkbox, postback |
| Thread Tools | |
|
|
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 |