By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Where to place <div>s in ASP script?

P: 56
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:
Expand|Select|Wrap|Line Numbers
  1. .solidBlue
  2.  
  3. {
  4.  
  5. border-style:solid; 
  6. border-color:#E2EFF8;
  7. border-width:thin;
  8. margin:15px; 
  9. width:150px; 
  10. padding:10px;
  11.  
  12. }
so my ASP code would need to be surrounded by

<div class="solidBlue">ASP script here</div>

The relevant ASP is this:

Expand|Select|Wrap|Line Numbers
  1. function SaveFiles
  2.     Dim Upload, fileName, fileSize, ks, i, fileKey
  3.  
  4. Set Upload = New FreeASPUpload
  5.  
  6.     Upload.Save(uploadsDirVar)
  7.  
  8.     ' If something fails inside the script, but the exception is handled
  9.     If Err.Number<>0 then Exit function
  10.  
  11.     SaveFiles = ""
  12.     ks = Upload.UploadedFiles.keys
  13.     if (UBound(ks) <> -1) then
  14.  
  15.  
  16.         SaveFiles = "<h4 class=""head"">Files uploaded:</h4> "
  17.         for each fileKey in Upload.UploadedFiles.keys
  18.  
  19.  
  20. SaveFiles = SaveFiles & "<p class=""head1"">" & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & " B)</p>"
  21.  
  22.         next
  23.     else
  24.         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."
  25.     end if
  26.     'SaveFiles = SaveFiles & "<br><p class=""head2"">Enter a number = " & Upload.Form("enter_a_number") & "</p>"
  27.     'SaveFiles = SaveFiles & "<p class=""head3"">Checkbox values = " & Upload.Form("checkbox_values") & "</p>"
  28.     'SaveFiles = SaveFiles & "<p class=""head4"">List values = " & Upload.Form("list_values") & "</p>"
  29.     'SaveFiles = SaveFiles & "<p class=""head5"">Text area = " & Upload.Form("t_area") & "</p>"
  30.  
  31. end function
  32. %>
Thank you for any advice.

Blue
Attached Images
File Type: jpg filesUploaded.jpg (83.6 KB, 104 views)
May 1 '14 #1

✓ answered by Luk3r

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.

Share this Question
Share on Google+
4 Replies


100+
P: 299
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.
May 1 '14 #2

jhardman
Expert 2.5K+
P: 3,405
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:
Expand|Select|Wrap|Line Numbers
  1. <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
May 1 '14 #3

100+
P: 299
OOPS! I confused myself too, apparently. My apologies.
May 1 '14 #4

jhardman
Expert 2.5K+
P: 3,405
you could also write it
Expand|Select|Wrap|Line Numbers
  1. <div><%
  2. response.write SaveFiles
  3. %></div>
but the result is the same.

Let me know if this helps.

Jared
May 1 '14 #5

Post your reply

Sign in to post your reply or Sign up for a free account.