Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to add multiple attachments dynamically using javascript?

How to add multiple attachments dynamically using javascript?

Scheduled Pinned Locked Moved ASP.NET
javascriptsysadminhelptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gyokusei
    wrote on last edited by
    #1

    Hi all, I want to add multiple attachments dynamically by using javascript. And this is my code:

    <div id="attachments">

    </div>

    function addMore:

    function addMore(id)
    {
    // create the next id
    var newid = eval(++id);

    // create a new fileupload control
    string s = "";
    
    // add the control above to the form
    document.getElementByID('attachments').innerHTML += s;
    

    }

    It works fine, but the problem is the value of "file_1" is empty after the function addMore called. So that I can't use method: Request.Files (which gets all fileupload controls' values on the form) on server. Any suggestions? Thanks! -- modified at 6:10 Wednesday 5th April, 2006

    R 1 Reply Last reply
    0
    • G gyokusei

      Hi all, I want to add multiple attachments dynamically by using javascript. And this is my code:

      <div id="attachments">

      </div>

      function addMore:

      function addMore(id)
      {
      // create the next id
      var newid = eval(++id);

      // create a new fileupload control
      string s = "";
      
      // add the control above to the form
      document.getElementByID('attachments').innerHTML += s;
      

      }

      It works fine, but the problem is the value of "file_1" is empty after the function addMore called. So that I can't use method: Request.Files (which gets all fileupload controls' values on the form) on server. Any suggestions? Thanks! -- modified at 6:10 Wednesday 5th April, 2006

      R Offline
      R Offline
      Ricardo Casquete
      wrote on last edited by
      #2

      Why don't you try a repeater... I mean, put To display all the Rows create a class with a property and add a item to a ArrayList the Items.... This means to do a PostBack... that is the worst point of my example and the best one of yours... Nevertheless I will try your solution Ricardo Casquete

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups