Click to See Complete Forum and Search --> : Loading Item from a Combo Box


February 28th, 2000, 01:05 PM
Hi,
I am new to ASP development.I have a COM Object running in MTS.
I want to populate the values in a combo box using the object Function.
Can anyone send me the coding ?
Thanx in Advance.

Regards,
Ram

Johnny101
February 28th, 2000, 02:30 PM
What type of object is your MTS component returning? Are you trying to load a combo box with records from a recordset? or just a collection of custom objects. In either case, the below should give a good idea of where to start:

'this example assumes you are filling a drop down combo with records from a recordset named rs
'yourpage.asp
'create the object, make the call to return the recordset.
'now fill the combo box:

dim str 'as string - to hold the HTML to build the control on the client side

'start the control's HTML code
str = "<Select name=ControlName>" & vbcrlf
While Not rs.EOF
'for each record in the rs, add a selection to the combo box
'the value parameter is required and can be a different value than that shown. this value is the
'value posted from the form (if you are using a form)
str = str & "<option value='" & rs(FieldName) & "'>" & rs(FieldName) & "</option>" & vbcrlf
rs.movenext
wend

str = str & "</select>"

response.write str




Hope this helps/applies,
John

John Pirkey
MCSD
www.ShallowWaterSystems.com