Setting Value From DB

Author Message
agantony

  • Total Posts : 15
  • Scores: 0
  • Reward points : 0
  • Joined: 3/23/2007
  • Status: offline
Setting Value From DB Saturday, April 14, 2007 4:16 AM (permalink)
0
Hi All,
 
I have a update page that has a dropdown list. I am tyying to set the selcted option from the DB. Is this possible the to achive it in this way?
 
Your advice is appreciated.. Many thanks
 
***********************************************************************************************************
 
<% strSelected =(RS("CALLSTATUS")) %>
 
<HTML CODE >
 
      <td width="120" class="fields"><div align="right">STATUS:</div></td>
      <td colspan="2" class="body"><select name="CALLSTATUS" size="1" class="body" id="CALLSTATUS">
        <option value="Call Open" > Call Open</option>
        <option value="Call Pending">Call Pending</option>
        <option value="Call Closed"> Call Closed</option>
  <option selected <%=(strSelected)%> </select></td>
    </tr>
 
<HTML END>
 
#1
    Snipah

    • Total Posts : 1339
    • Scores: 8
    • Reward points : 0
    • Joined: 11/1/2004
    • Location: Scotland
    • Status: offline
    RE: Setting Value From DB Saturday, April 14, 2007 7:43 AM (permalink)
    0
    so you want the db content enumerated in the <option> lists?
    For more information, please see the "Read me First" topic.

    http://www.visualbasicscript.com
     
    #2
      agantony

      • Total Posts : 15
      • Scores: 0
      • Reward points : 0
      • Joined: 3/23/2007
      • Status: offline
      RE: Setting Value From DB Saturday, April 14, 2007 3:40 PM (permalink)
      0
      Hi Snipah,
       
      I dont think I have explained myself properly. I am using asp to write to a database. The snippet of code above, loads a record from the DB to be updated. One of the fields of the update form is a drop down list containing 3 values Call Pending, Call Closed and Call Open. I am trying to select the relevant option from the list using a value (Call Pending, Call Closed and Call Open) from the record when the database record is loaded.
       
      Likewise, I have 2 check boxes (Yes / No) on the same update form, and I would also like to check the relevent button from a value stored in the database record. any suiggestions?
       
       
      Regards
       
      #3
        Snipah

        • Total Posts : 1339
        • Scores: 8
        • Reward points : 0
        • Joined: 11/1/2004
        • Location: Scotland
        • Status: offline
        RE: Setting Value From DB Saturday, April 14, 2007 9:30 PM (permalink)
        0
        confirm if this is the direction you want (taking the checkbox example)

        If dbValueYesNo = "yes" Then
        document.getElementByID("optCheckBoxYES").checked = true
        document.getElementByID("optCheckBoxNO").checked = false
        Else
        document.getElementByID("optCheckBoxYES").checked = false
        document.getElementByID("optCheckBoxNO").checked = true
        End If

        (same applies for the option list, only that takes different attributes...)
        For more information, please see the "Read me First" topic.

        http://www.visualbasicscript.com
         
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9