SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    Denver
    Posts
    385
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    keeping track of listbox items. Looking for ideas.

    Hello guys,

    I have a secnario in my web site and I want some input if you have a good idea of how to do this. Here it is...

    I have a page that contains a list box <select></select> with several items in it <option></option>. these items come from a database table into a visual basic.net for loop that creates a the <options> HTML tags for me. my database table contains several columns, a couple of them are the descrption and value among many others that I use to fill the <option value (<option Value="") and the text of the item as I'm looping through the rows I get back from the DB in my VB Code.
    Here is the problem now. I'm trying to find a way to store the rest of the column values that I get from the DB, so lets say the DB table contains a Description, Value, Required, Sold) columns. as I mentioned above, I get a row from the DB table, store the description, and value in the <option value> but I get stuck when it comes to finding a way to store the rest of the values from the other columns (rquired, sold, etc..) I want to find a way where I can keep track of these values, because they user will have the ability to manuplate the items in the list box (move them up, down, delete, add new ones) I thought about doing custom HTML attributes (in each <option> have a <option value="" required="" sold="">), but then I was told it's not cross-browser compatible, other ideas such as having multi-diminshinal arrays where I can assign values to a javascript array as I loop and create the list box in VB.
    I know there are a bunch of smart guys who post on sitepoint with great ideas!! let me know what you think. Thanks.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    may be to store all the variables in a sting variable with each variable value separated by a charactor say '^' use the string variable as the select value then split the value when you want to use it

    ie value.split('^')[2] could be the 'Required' value


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •