Time Saver - Making Combo boxes

Discussion in 'C#' started by jaymcc, Jan 31, 2006.

  1. #1
    This is a function i put into most ASP sites I build, makes it really easy to put together drop down lists:

    function MakeComboBox(ComboName, rsTemp, ValueField, DescriptionField, Prompt)
     Response.write "<SELECT Name=""" & ComboName & """>"
     Response.write "<OPTION Value=""0"">" & Prompt & "</OPTION>"
     while not rsTemp.EOF
      Response.write "<OPTION Value=""" & rsTemp(ValueField) & """>" & rsTemp(DescriptionField) & "</OPTION>"
     
      rsTemp.MoveNext
     wend
     
     response.write "</SELECT>"
    end function
    
    Code (markup):

     
    jaymcc, Jan 31, 2006 IP