This is a discussion on "Advice on Session variables with checkbox." within the ASP.NET Forum section. This forum, and the thread "Advice on Session variables with checkbox. are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Advice on Session variables with checkbox.
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Advice on Session variables with checkbox.
I have to do a checklist box in a web form.
I have to store the values in a session. How would you go about it for storing multiple selections. I have a scenerio for listbox I will be populating the checkbox like the listbox using xml file. Here is the logic for a listbox. I would like u're opinion? Thanks. private DataView CountriesList { get { DataSet myDataSet = new DataSet(); myDataSet.ReadXml(Server.MapPath("GeneralInformati on/countries.xml")); return (myDataSet.Tables["country].DefaultView); } } private void FilllbCountry(DataView data) { this.lbCountry.DataSource = data; this.lbCountry.DataMember = "title"; this.lbCountry.DataTextField = "text"; this.lbCountry.DataValueField = "value"; this.lbCountry.DataBind(); // restore the selected title (if a user had already selected a title on a previous page session) if (Session["webform2_lbCountry] != null) { foreach (ListItem item in this.lbCountry.Items ) { if (item.Value == Session["webform2_lbCountry].ToString()) { this.lbCountry.SelectedIndex = this.lbCountry.Items.IndexOf(item); } } } } private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) // Evals true first time browser hits the page { FilllbCountry (CountriesList); } // !PostBack } // PageLoad private void InitializeComponent() { this.lbCountry.SelectedIndexChanged += new System.EventHandler(this.lbCountry_SelectedIndexCh anged); } |
|
|
![]() |
| Tags |
| advice, session, variables, checkbox |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP Problems with Session Variables... | JustinStudios | PHP Forum | 5 | Jan 17th, 2008 05:05 |
| Session variables | ideleon | PHP Forum | 2 | Feb 7th, 2006 08:04 |
| Session Variables.... | courtjester | Classic ASP | 11 | Jul 6th, 2004 00:04 |
| Session Variables | ekendricks | Classic ASP | 4 | Dec 19th, 2003 06:33 |
| Session Variables | ekendricks | Classic ASP | 7 | Aug 26th, 2003 10:42 |