Loading mutiple fields (cols) into list box

Results 1 to 2 of 2

Thread: Loading mutiple fields (cols) into list box

  1. #1
    bnath Guest

    Default Loading mutiple fields (cols) into list box

    Pls help.<BR><BR>I have a list box and I am loading around 3 fields (for each record using ASP code) . <BR>Inorder to separte each field in the rows, I have inserted "_" between the fields. But in some records field2 might be 10 charecters and in some records it might be 22 charecter. But the field length for field2 and field3 is 30 charecters So I have added the below logic (used String function) . I thought field3 in all records should start at say 45th charecter. But it doesn&#039;t . <BR>Any idea how to load multiple fields into a list box so that they apprear decently.<BR><BR>Response.Write "&#060;select id=winActive name=winActive size=10 multiple=true style=&#039;WIDTH: 800px; FONT-FAMILY: Fixedsys; FONT-SIZE: 8pt&#039;&#062;"<BR> <BR>if objRst.EOF = false then<BR> objRst.movefirst<BR> do until objRst.eof<BR> optVal = objRst("source") & "__" & objRst("VenID") & string(13-len(objRst("VenID")), "_") & objRst("VenName") & string(45-len(objRst("VenName")),"_") & objRst("newVenName")<BR> Response.write "&#060;option value=" & objRst("recid") & "&#062;" & optVal & "&#060;/option&#062;"<BR> objRst.movenext<BR>loop<BR>end if<BR>Response.Write "&#060;/select

  2. #2
    Join Date
    Dec 1969

    Default Your logic is faulty...

    You are asking for a number of _ characters, *NOT* for a *position* of so many characters.<BR><BR>You don&#039;t say how many characters objRst("source") occupies, but I assume it is a fixed number. Let&#039;s say 2 just for convenience. And then you have 2 underlines, right? And then this part:<BR>&nbsp; &nbsp; &nbsp; objRst("VenID") & string(13-len(objRst("VenID")), "_") <BR>combines to occupy 13 character spaces, right? SO that&#039;s 2 (or whatever) plus 2 plus 13, or 17 characters. So VenName will start at character 18. Then<BR>&nbsp; &nbsp; &nbsp; ("VenName") & string(45-len(objRst("VenName")),"_") <BR>combine to occupy 45 character spaces. So 45 plus 17 is 62. So objRst("newVenName") will start at character 63. <BR><BR>Makes perfect sense to me.<BR><BR>You *are* aware that this won&#039;t work in any browser but MSIE, yes? Netscape, for example, doesn&#039;t allow you to choose a font for the &#060;SELECT&#062; control. <BR><BR><BR>

Posting Permissions

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