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 convert System.Web.UI.WebControls.FileUpload to System.string?

How to convert System.Web.UI.WebControls.FileUpload to System.string?

Scheduled Pinned Locked Moved ASP.NET
questiondesignhelptutorial
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.
  • L Offline
    L Offline
    lsh486love
    wrote on last edited by
    #1

    Hello, I'm making a bulletin board with multi-file upload. when I click Edit button, I would like to show files that I uploaded on ListBox. so, I used both of "System.Web.UI.HtmlControls.HtmlInputFile" and "System.Web.UI.WebControls.FileUpload". this is my code. static public ArrayList hif = new ArrayList(); for(System.Web.UI.WebControls.FileUpload HIF in hif) { ... } hif.Add(ListBox1.SelectedValue); It gives error cannot convert System.Web.UI.WebControls.FileUpload to System. I know ListBox1.SetectedValue is string data type. How can I convert System.Web.UI.WebControls.FileUpload to System.string? p.s. I tried to use like this . (FileUpload)ListBox1.SelectedValue. but that can't be converted. Thanks.

    C 1 Reply Last reply
    0
    • L lsh486love

      Hello, I'm making a bulletin board with multi-file upload. when I click Edit button, I would like to show files that I uploaded on ListBox. so, I used both of "System.Web.UI.HtmlControls.HtmlInputFile" and "System.Web.UI.WebControls.FileUpload". this is my code. static public ArrayList hif = new ArrayList(); for(System.Web.UI.WebControls.FileUpload HIF in hif) { ... } hif.Add(ListBox1.SelectedValue); It gives error cannot convert System.Web.UI.WebControls.FileUpload to System. I know ListBox1.SetectedValue is string data type. How can I convert System.Web.UI.WebControls.FileUpload to System.string? p.s. I tried to use like this . (FileUpload)ListBox1.SelectedValue. but that can't be converted. Thanks.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You can call ToString(), but I doubt that's what you want. I assume you want to select the Filename property on the object. I thikn you need a good book on OO before you do any more work.

      Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )

      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