Advice on Session variables with checkbox.

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.



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

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 25th, 2003, 16:33
New Member
Join Date: Sep 2003
Location: Canada
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
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);


}

Closed Thread

Tags
advice, session, variables, checkbox

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
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


All times are GMT. The time now is 22:30.


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