asp code does not render for first record in looped recordset

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • haft@canchair.com

    asp code does not render for first record in looped recordset

    I have posted this question on a javascript forum as it contains
    javascript code however it was believed to be an asp issue.

    The following head section javascript code contains the function
    showBigImage( isource,bigImag e,header ) function call of discussion:

    var currentImage;
    function showBigImage( isource,bigImag e,header ) {
    var theImage = document.getEle mentById( 'largeimage' );
    theImage.src = isource;
    currentImage = bigImage;
    document.getEle mentById( 'photoHeader' ).innerHTML=hea der;
    document.getEle mentById( 'largeimage' ).alt=header;

    The following rendered looped recordset code illustrates how the
    "header" parameter of this showBigImage( isource,bigImag e,header )
    function call does not render ONLY FOR THE FIRST RECORD OF THE
    RECORDSET as it is blank:

    <a href= "javascript :;" <td height=36 valign="middle"
    class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?
    path=images/portable_stage. jpg&width=250', 'images/
    portable_stage. jpg','' )"<img src="imagescrip t.asp?path=imag es/
    portable_stage. jpg&width=36" border="0" alt="" /</td</a>

    <a href= "javascript :;" <td height=36 valign="middle"
    class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?
    path=images/seated_riserset .jpg&width=250' ,'images/
    seated_riserset .jpg','Portable stage configuration using 9 units of
    the 3 ft x 8 ft platforms in 3 different heights' )"<img
    src="imagescrip t.asp?path=imag es/seated_riserset .jpg&width=36"
    border="0" alt="" /</td</a>

    <a href= "javascript :;" <td height=36 valign="middle"
    class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?
    path=images/Stageset.jpg&wi dth=250','image s/Stageset.jpg',' Portable
    stage configuration using 16 units of the 4 ft x 8 ft platforms' )">
    <img src="imagescrip t.asp?path=imag es/Stageset.jpg&wi dth=36"
    border="0" alt="" /</td</a>

    <a href= "javascript :;" <td height=36 valign="middle"
    class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?
    path=images/Runset.jpg&widt h=250','images/Runset.jpg','Po rtable stage
    runset configuration' )"<img src="imagescrip t.asp?path=imag es/
    Runset.jpg&widt h=36" border="0" alt="" /</td</a>


    Because of this problem, the caption text does not display for this
    first image record once the thumbnail images are moused over. You can
    view this page example at

  • Evertjan.

    #2
    Re: asp code does not render for first record in looped recordset

    wrote on 22 jul 2008 in microsoft.publi c.inetserver.as p.general:
    I have posted this question on a javascript forum as it contains
    javascript code however it was believed to be an asp issue.
    There is no ASP code in the below.
    The following head section javascript code contains the function
    showBigImage( isource,bigImag e,header ) function call of discussion:
    >
    var currentImage;
    function showBigImage( isource,bigImag e,header ) {
    var theImage = document.getEle mentById( 'largeimage' );
    theImage.src = isource;
    currentImage = bigImage;
    document.getEle mentById( 'photoHeader' ).innerHTML=hea der;
    document.getEle mentById( 'largeimage' ).alt=header;
    This is clientside code, so you are off topic.
    The following rendered looped recordset code illustrates how the
    "header" parameter of this showBigImage( isource,bigImag e,header )
    function call does not render ONLY FOR THE FIRST RECORD OF THE
    RECORDSET as it is blank:
    >
    <a href= "javascript :;" <td height=36 valign="middle"
    class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?
    path=images/portable_stage. jpg&width=250', 'images/
    portable_stage. jpg','' )"<img src="imagescrip t.asp?path=imag es/
    portable_stage. jpg&width=36" border="0" alt="" /</td</a>
    >
    <a href= "javascript :;" <td height=36 valign="middle"
    class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?
    path=images/seated_riserset .jpg&width=250' ,'images/
    seated_riserset .jpg','Portable stage configuration using 9 units of
    the 3 ft x 8 ft platforms in 3 different heights' )"<img
    src="imagescrip t.asp?path=imag es/seated_riserset .jpg&width=36"
    border="0" alt="" /</td</a>
    >
    <a href= "javascript :;" <td height=36 valign="middle"
    class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?
    path=images/Stageset.jpg&wi dth=250','image s/Stageset.jpg',' Portable
    stage configuration using 16 units of the 4 ft x 8 ft platforms' )">
    <img src="imagescrip t.asp?path=imag es/Stageset.jpg&wi dth=36"
    border="0" alt="" /</td</a>
    >
    <a href= "javascript :;" <td height=36 valign="middle"
    class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?
    path=images/Runset.jpg&widt h=250','images/Runset.jpg','Po rtable stage
    runset configuration' )"<img src="imagescrip t.asp?path=imag es/
    Runset.jpg&widt h=36" border="0" alt="" /</td</a>
    >
    >
    Because of this problem, the caption text does not display for this
    first image record once the thumbnail images are moused over. You can
    view this page example at

    tFamily=1&Produ ctFamilySub=10
    >


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Bob Barrows [MVP]

      #3
      Re: asp code does not render for first record in looped recordset

      haft@canchair.c om wrote:
      I have posted this question on a javascript forum as it contains
      javascript code however it was believed to be an asp issue.
      Given that there is no server-side code shown here, I'm not sure what
      led whoever it was to believe that this was an ASP issue.

      If it is an asp issue then we have no chance of debugging it without
      seeing the server-side code contained in ...imagescript. asp
      --
      Microsoft MVP -- ASP/ASP.NET
      Please reply to the newsgroup. The email account listed in my From
      header is my spam trap, so I don't check it very often. You will get a
      quicker response by posting to the newsgroup.


      Comment

      • haft@canchair.com

        #4
        Re: asp code does not render for first record in looped recordset

        On Jul 22, 4:24 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
        wrote:
        h...@canchair.c om wrote:
        I have posted this question on a javascript forum as it contains
        javascript code however it was believed to be an asp issue.
        >
        Given that there is no server-side code shown here, I'm not sure what
        led whoever it was to believe that this was an ASP issue.
        >
        If it is an asp issue then we have no chance of debugging it without
        seeing the server-side code contained in ...imagescript. asp
        --
        Microsoft MVP -- ASP/ASP.NET
        Please reply to the newsgroup. The email account listed in my From
        header is my spam trap, so I don't check it very often. You will get a
        quicker response by posting to the newsgroup.
        You are absolutely right. I should've posted the asp code and here it
        is:

        <a href= "javascript :;" class="small_im g" >
        <td height=36 valign="middle"
        class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?path=<%=
        images.Fields.I tem( "url_img" ).Value %>&width=250',' <%=
        images.Fields.I tem( "url_img" ).Value %>','<
        %=(images.Field s.Item("alt_img ").Value)%> ' )"><img
        src="imagescrip t.asp?path=<%= images.Fields.I tem( "url_img" ).Value
        %>&width=36" border="0" alt="" /</td>
        </a>

        Comment

        • Evertjan.

          #5
          Re: asp code does not render for first record in looped recordset

          wrote on 23 jul 2008 in microsoft.publi c.inetserver.as p.general:
          On Jul 22, 4:24 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
          wrote:
          >h...@canchair. com wrote:
          I have posted this question on a javascript forum as it contains
          javascript code however it was believed to be an asp issue.
          >>
          >Given that there is no server-side code shown here, I'm not sure what
          >led whoever it was to believe that this was an ASP issue.
          >>
          >If it is an asp issue then we have no chance of debugging it without
          >seeing the server-side code contained in ...imagescript. asp
          >--
          >Microsoft MVP -- ASP/ASP.NET
          >Please reply to the newsgroup. The email account listed in my From
          >header is my spam trap, so I don't check it very often. You will get
          >a quicker response by posting to the newsgroup.
          >
          You are absolutely right. I should've posted the asp code and here it
          is:
          >
          <a href= "javascript :;" class="small_im g" >
          <td height=36 valign="middle"
          class="small_im g" onmouseover="sh owBigImage(
          'imagescript.as p?path=<%images .Fields.Item( "url_img" ).Value
          %>&width=250',' <%images.Fields .Item( "url_img" ).Value %>','<
          %=(images.Field s.Item("alt_img ").Value)%> ' )"><img
          src="imagescrip t.asp?path=<%= images.Fields.I tem( "url_img" ).Value
          %>&width=36" border="0" alt="" /</td>
          </a>
          >
          If the ASP string is correct, even then this:

          <%images.Fields .Item( "url_img" ).Value %>

          will not do in ASP, or render to the html-string, anything,
          so perhaps you want to try:

          <% = images.Fields.I tem( "url_img" ).Value %>

          [etc.]

          However,
          since you do not show the relevant serverside database access code,
          or even what database you use,
          I cannot say.

          And we do not know if imagescript.asp will process the querystring value
          correctly

          And if the resultstring of
          <% = images.Fields.I tem( "url_img" ).Value %>
          is encoded to precvent it to have characters that break the querystring,
          [like an apostrophe].

          Even the html is wrong:
          <td .... /></td>
          [why the /?]
          and
          <a ...><td .... /></td>...</a>
          is wrong,
          and
          <a href= "javascript :;" class="small_im g" >
          is questionable,
          but that all is off topic on this NG.


          --
          Evertjan.
          The Netherlands.
          (Please change the x'es to dots in my emailaddress)

          Comment

          • Bob Barrows [MVP]

            #6
            Re: asp code does not render for first record in looped recordset

            haft@canchair.c om wrote:
            On Jul 22, 4:24 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
            wrote:
            >h...@canchair. com wrote:
            >>I have posted this question on a javascript forum as it contains
            >>javascript code however it was believed to be an asp issue.
            >>
            >Given that there is no server-side code shown here, I'm not sure what
            >led whoever it was to believe that this was an ASP issue.
            >>
            >If it is an asp issue then we have no chance of debugging it without
            >seeing the server-side code contained in ...imagescript. asp
            >
            You are absolutely right. I should've posted the asp code and here it
            is:
            >
            <a href= "javascript :;" class="small_im g" >
            <td height=36 valign="middle"
            class="small_im g" onmouseover="sh owBigImage( 'imagescript.as p?path=<%=
            images.Fields.I tem( "url_img" ).Value %>&width=250',' <%=
            images.Fields.I tem( "url_img" ).Value %>','<
            %=(images.Field s.Item("alt_img ").Value)%> ' )"><img
            src="imagescrip t.asp?path=<%= images.Fields.I tem( "url_img" ).Value
            %>&width=36" border="0" alt="" /</td>
            </a>
            Err ... that is not the code contained in imagescript.asp is it? No mention
            of a recordset, for one thing ...

            --
            Microsoft MVP - ASP/ASP.NET
            Please reply to the newsgroup. This email account is my spam trap so I
            don't check it very often. If you must reply off-line, then remove the
            "NO SPAM"


            Comment

            • haft@canchair.com

              #7
              Re: asp code does not render for first record in looped recordset

              i really appreciate the responses.


              the imagescript page is the page that resizes the images but i have no
              issues with the images but rather the alt_img database field not
              rendering properly for the initial recordset value.

              and database type is Access.


              imagescript.asp code:

              <%


              Response.Expire s = 0
              ' create instance of AspJpeg
              Set Jpeg = Server.CreateOb ject("Persits.J peg")

              If Request.QuerySt ring("width")=3 6 Then
              Jpeg.New 36, 36, &HFFFFFF
              Else
              Jpeg.New 250, 250, &HFFFFFF
              End If

              ' Open source file
              Jpeg.Open Server.MapPath( Request.QuerySt ring("path"))

              'Jpeg.Width = Request("Width" )

              L = Request("Width" )

              'Jpeg.Height = Jpeg.OriginalHe ight * Jpeg.Width / Jpeg.OriginalWi dth

              If jpeg.OriginalWi dth jpeg.OriginalHe ight Then
              jpeg.Width = L
              jpeg.Height = jpeg.OriginalHe ight * L / jpeg.OriginalWi dth
              Else
              jpeg.Height = L
              jpeg.Width = jpeg.OriginalWi dth * L / jpeg.OriginalHe ight
              End If

              ' Perform resizing and
              ' send resultant image to client browser
              Jpeg.SendBinary

              %>

              Comment

              • haft@canchair.com

                #8
                Re: asp code does not render for first record in looped recordset

                This is the code to narrow in on:

                onmouseover="sh owBigImage( 'imagescript.as p?path=<%=
                images.Fields.I tem( "url_img" ).Value %>&width=250',' <%=
                images.Fields.I tem( "url_img" ).Value %>','<
                %=(images.Field s.Item("alt_img ").Value)%> ' )">

                This '<%=(images.Fie lds.Item("alt_i mg").Value)%> ' portion of the code
                is what is not rendering for the initial image of the recordset

                Comment

                • Bob Barrows [MVP]

                  #9
                  Re: asp code does not render for first record in looped recordset

                  haft@canchair.c om wrote:
                  i really appreciate the responses.
                  >
                  >
                  the imagescript page is the page that resizes the images but i have no
                  issues with the images but rather the alt_img database field not
                  rendering properly for the initial recordset value.
                  So I guess I still don't understand the suspicion that this is an
                  ASP/server-side code problem.
                  >
                  and database type is Access.
                  >
                  >
                  imagescript.asp code:
                  >
                  <snip>
                  Still no mention of a recordset ... ?
                  I don't know how we can help.

                  --
                  Microsoft MVP -- ASP/ASP.NET
                  Please reply to the newsgroup. The email account listed in my From
                  header is my spam trap, so I don't check it very often. You will get a
                  quicker response by posting to the newsgroup.


                  Comment

                  • Bob Barrows [MVP]

                    #10
                    Re: asp code does not render for first record in looped recordset

                    haft@canchair.c om wrote:
                    This is the code to narrow in on:
                    >
                    onmouseover="sh owBigImage( 'imagescript.as p?path=<%=
                    images.Fields.I tem( "url_img" ).Value %>&width=250',' <%=
                    images.Fields.I tem( "url_img" ).Value %>','<
                    %=(images.Field s.Item("alt_img ").Value)%> ' )">
                    >
                    This '<%=(images.Fie lds.Item("alt_i mg").Value)%> ' portion of the code
                    is what is not rendering for the initial image of the recordset
                    No it isn't. There is no mention of a recordset here, unless images is a
                    recordset object. If so, we need to see the code used to open the
                    recordset (and its connection) as well as a description of the database
                    table (field datatypes and names), along with the code used to navigate
                    to the record whose alt_img field you wish to display. Try to slice out
                    as much html as possible so we can focus on the server-side ADO code.


                    --
                    Microsoft MVP -- ASP/ASP.NET
                    Please reply to the newsgroup. The email account listed in my From
                    header is my spam trap, so I don't check it very often. You will get a
                    quicker response by posting to the newsgroup.


                    Comment

                    • Daniel Crichton

                      #11
                      Re: asp code does not render for first record in looped recordset

                      haft@canchair.c om wrote on Wed, 23 Jul 2008 07:45:54 -0700 (PDT):
                      This is the code to narrow in on:
                      onmouseover="sh owBigImage( 'imagescript.as p?path=<%=
                      images.Fields.I tem( "url_img" ).Value %>&width=250',' <%=
                      images.Fields.I tem( "url_img" ).Value %>','<
                      %=(images.Field s.Item("alt_img ").Value)%> ' )">
                      This '<%=(images.Fie lds.Item("alt_i mg").Value)%> ' portion of the code
                      is what is not rendering for the initial image of the recordset

                      Silly question, but are you sure the value of alt_img for that row in the
                      database actually has a value?

                      And another thing to consider (which shouldn't affect this though) is that
                      you should ensure that there is no way to get an apostrophe into your
                      database, or if you do allow it that you ensure that you escape it (ie store
                      it as \') or else you risk breaking the javascript handling in the client
                      (or even worse potentially allowing cross-site scripting).

                      --
                      Dan


                      Comment

                      • =?Utf-8?B?T2xkIFBlZGFudA==?=

                        #12
                        RE: asp code does not render for first record in looped recordset

                        Not sure why some posters thought this had anything to do with JS and nothing
                        to do with recordset.

                        I certainly don't know anything other than a recordset object that uses the
                        code pattern
                        [name].Field.Item('.. .fieldname...") .Value

                        Now, it's also true that DumbWeaver is plunking in way too much code there.

                        The expression
                        <% = images.Fields.I tem( "url_img" ).Value %>
                        is 100% equivalent to the easier-to-write, easier-to-read, and MEASURABLY
                        FASTER
                        <%=images("url_ img")%>
                        And I do recommend that you switch to that.

                        ***************

                        Having said all that.

                        I see no reason at all in any of your code that the first description
                        doesn't show up in the output. (And it's clearly nothing to do with
                        apostrophes...a VIEW-->>SOURCE of the HTML of your page shows that there is
                        NOTHING WHATSOEVER there.)

                        So I have to question your actual database. Are you 100% *SURE* that you
                        actually *HAVE* any text in the
                        alt_img
                        field for that given
                        url_img
                        value????

                        In other words, go into your Access database (using Access, not using ASP,
                        not using DumbWaster) and find the record where
                        url_img
                        is
                        images/portable_stage. jpg
                        Then, *IN THAT SAME RECORD*, find what the value of
                        alt_img
                        is. I am personally betting that the value is blank. And so you are
                        getting exactly what you should.

                        *************** *******

                        I do note that your code isn't *REALLY* doing what it *SHOULD* be doing.

                        You said to look at the URL


                        I did. I also looked at
                        ProductID=111
                        and
                        ProductFamilySu b=12
                        and tried various other combinations. And I still got the same images, no
                        matter what.

                        So given all that, maybe it's not surprising that the DB doesn't have a
                        value in one field when you think it should.

                        *************** *************** *******

                        By the not so insignifcant by...your HTML code is ILLEGAL. It is rendering
                        thus:

                        <a href= "javascript :;" class="small_im g" >
                        <td height=36 valign="middle" class="small_im g"
                        onmouseover="sh owBigImage(
                        'imagescript.as p?path=images/portable_stage. jpg&width=250', 'images/portable_stage. jpg',''
                        )"><img src="imagescrip t.asp?path=imag es/portable_stage. jpg&width=36"
                        border="0" alt="" </td>
                        </a>
                        But it's illegal to have <A>...</Atags *OUTSIDE* of the <TD>...</TDtags.

                        As it turns out, MSIE is sloppy and allows this. Don't count on other
                        browser to do so.

                        Of course, the bigger question is a simple one: What's the point of the <A>
                        tag there, in the first place????? It is doing EXACTLY NOTHING. I would
                        string recommend removing the <Aand </Atags.

                        Comment

                        • Bob Barrows [MVP]

                          #13
                          Re: asp code does not render for first record in looped recordset

                          Old Pedant wrote:
                          Not sure why some posters thought this had anything to do with JS and
                          nothing
                          to do with recordset.
                          >
                          If you're asking why I missed it, the answer is simple: I do not expect to
                          see a recordset object named "images". Even if I had, I still had not seen
                          enough to decide where the problem was.


                          --
                          Microsoft MVP - ASP/ASP.NET
                          Please reply to the newsgroup. This email account is my spam trap so I
                          don't check it very often. If you must reply off-line, then remove the
                          "NO SPAM"


                          Comment

                          • =?Utf-8?B?T2xkIFBlZGFudA==?=

                            #14
                            Re: asp code does not render for first record in looped recordset

                            "Bob Barrows [MVP]" wrote:
                            If you're asking why I missed it, the answer is simple: I do not expect to
                            see a recordset object named "images".
                            I thought you weren't only one that missed that. I thought a couple of
                            other posters did.

                            But no matter. It's obvious you haven't had to work with the junk that DW
                            produces as much as I have. I recognized its patterns (even its BigImage
                            stuff) right off. I think, all in all, you should consider yourself very
                            fortunate. <grin/>

                            [I admit, I tend to go overboard, ragging on DreamWeaver, but sheesh!
                            They've been producing the same crappy code since 1998 or so. I'm sure
                            nobody is doing any active work on improving it, today, but you'd think that
                            SOMEBODY would have changed SOME of their idiocies back in 2000 through 2002
                            or so.]




                            Even if I had, I still had not seen
                            enough to decide where the problem was.
                            >
                            >
                            --
                            Microsoft MVP - ASP/ASP.NET
                            Please reply to the newsgroup. This email account is my spam trap so I
                            don't check it very often. If you must reply off-line, then remove the
                            "NO SPAM"
                            >
                            >
                            >

                            Comment

                            • Dooza

                              #15
                              Re: asp code does not render for first record in looped recordset

                              Old Pedant wrote:
                              [I admit, I tend to go overboard, ragging on DreamWeaver, but sheesh!
                              They've been producing the same crappy code since 1998 or so. I'm sure
                              nobody is doing any active work on improving it, today, but you'd think that
                              SOMEBODY would have changed SOME of their idiocies back in 2000 through 2002
                              or so.]
                              Dreamweaver CS4 is in public beta, all they did was break the UI and
                              improve the CSS abilities. The server side code hasn't changed since DW8
                              where they introduced paramatised commands to help prevent SQL injection.

                              Dreamweaver users have been screaming out for improved server side code
                              support for many years. Due to the poor support of server side code, and
                              regular browsing of this newsgroup, I have improved my asp/vbscript
                              coding abilities, but still use Dreamweaver to "design" my web applications.

                              Steve

                              Comment

                              Working...