Where to place <div>s in ASP script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bluenose
    New Member
    • Apr 2012
    • 56

    Where to place <div>s in ASP script?

    Hello

    I am unsure where to place a <div></div> in my ASP script. I am trying to achieve something like the box that shows uploaded files in the attached screenshot.

    The CSS I have is this:
    Code:
    .solidBlue
    
    {
    
    border-style:solid; 
    border-color:#E2EFF8;
    border-width:thin;
    margin:15px; 
    width:150px; 
    padding:10px;
    
    }
    so my ASP code would need to be surrounded by

    <div class="solidBlu e">ASP script here</div>

    The relevant ASP is this:

    Code:
    function SaveFiles
        Dim Upload, fileName, fileSize, ks, i, fileKey
    
    Set Upload = New FreeASPUpload
    
        Upload.Save(uploadsDirVar)
    
    	' If something fails inside the script, but the exception is handled
    	If Err.Number<>0 then Exit function
    
        SaveFiles = ""
        ks = Upload.UploadedFiles.keys
        if (UBound(ks) <> -1) then
    
    
            SaveFiles = "<h4 class=""head"">Files uploaded:</h4> "
            for each fileKey in Upload.UploadedFiles.keys
               
    
    SaveFiles = SaveFiles & "<p class=""head1"">" & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & " B)</p>"
    
            next
        else
            SaveFiles = "No file selected for upload or the file name specified in the upload form does not correspond to a valid file in the system."
        end if
    	'SaveFiles = SaveFiles & "<br><p class=""head2"">Enter a number = " & Upload.Form("enter_a_number") & "</p>"
    	'SaveFiles = SaveFiles & "<p class=""head3"">Checkbox values = " & Upload.Form("checkbox_values") & "</p>"
    	'SaveFiles = SaveFiles & "<p class=""head4"">List values = " & Upload.Form("list_values") & "</p>"
    	'SaveFiles = SaveFiles & "<p class=""head5"">Text area = " & Upload.Form("t_area") & "</p>"
    
    end function
    %>
    Thank you for any advice.

    Blue
    Attached Files
  • Luk3r
    Contributor
    • Jan 2014
    • 300

    #2
    I'm no expert in ASP.NET but I believe you actually have to generate your HTML code then add your <div>'s code within the HTML around the section that you want the border to appear.

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      Luk3r, please don't confuse me, we are talking ASP, not ASP.net :)

      Bluenose, this is easy. the function can be anywhere, for ease of reference, put it on the top of the page. write the divs like this:
      Code:
      <div><%=SaveFiles%></div>
      when the script executes it doesn't do anything when it reads the function definition. But when it gets to the div it executes the function and puts the result right there. does this make sense?

      Jared

      Comment

      • Luk3r
        Contributor
        • Jan 2014
        • 300

        #4
        OOPS! I confused myself too, apparently. My apologies.

        Comment

        • jhardman
          Recognized Expert Specialist
          • Jan 2007
          • 3405

          #5
          you could also write it
          Code:
          <div><%
          response.write SaveFiles
          %></div>
          but the result is the same.

          Let me know if this helps.

          Jared

          Comment

          Working...