www.webdeveloper.com
Results 1 to 4 of 4

Thread: Databound DropDownList from DB Table Columns

  1. #1
    Join Date
    Apr 2004
    Posts
    27

    Databound DropDownList from DB Table Columns

    I would like to create a DB sort interface and part of it involves a dropdown of table column names in conjunction with a sort order dropdown (asc,dsc). How can I bind a currently opened db.table.column names as wells as values to the dropdown?

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,224
    I do not quite understand the question.
    To put a drop down list in a particular order you are going to do it the same way as anything else. You are going to create a data set and order that either asc or desc and then bind the list to it. Do you want to change how the data grid is ordered by the value of the drop down list? I would just have a drop down and a command button, the button would resend the page when the user selects what he wants to order by, the button will fire a script that redirects the page to its self but with a query string witht he value of whatever selection. You take that value then in form load order by that value variable which would be a table column. So the drop down list values would be table column names. Also thrown in asc and desc by saying if querysting order = asc run this statement if order = desc run this one.

  3. #3
    Join Date
    Apr 2004
    Posts
    27

    Talking Clarity is best :]

    I have a DATAGRID that is bound to a dynamic SQL statement triggered via an AutoPostBack DDL (background info). Now I would like to have an interface where I could specify sorting by columns so I have to do a databound dropdownlist that will grab the current table's columns as dropdownlist text and values. I hope this clarifies rather than muddles...

  4. #4
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,224
    Oh, I would just make another table called columns in the db and then put those into a data set for th elist. Then you can run those autogen coloumns for the grid. I do not know how you would go about getting what the cols are for a table, but I would imageine you could... I just do not have the faintest idea how.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles