Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6914837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:23:56+00:00 2026-05-27T09:23:56+00:00

MVC 3. VB.NET application.. I am trying to pass a id along to keep

  • 0

MVC 3. VB.NET application.. I am trying to pass a id along to keep track of which record a file name needs to be saved in.. The problem is that the id is getting passed into the view but on post back to the controller it is being lost…I have hammered on this for hours now and I am stuck… Any Ideas??

 @ModelType xxxxxxxxxxx.fileUploadVM
 @Code
 ViewData("Title") = "Upload Resume"
 Layout = "~/Views/Shared/_Layout.vbhtml"
 End Code
 @Html.HiddenFor(Function(m) m.id)
<h2>Upload Resume</h2>
<p style="text-align: center">Please Upload your resume below.</p>
<ul>

<form action="UploadResume" method="post" enctype="multipart/form-data">   
<label for="file">Filename:</label>    <input type="file" name="file" id="file" />  
<input type="submit" name="submit" value="Submit" /></form> 
</ul> 

Controller functions look like this:

 Function UploadResume(ByVal id As Integer) As ActionResult
    Dim filevm As New fileUploadVM
    filevm.id = id
    Return View(filevm)
End Function

<AcceptVerbs(HttpVerbs.Post)>
Public Function UploadResume(ByVal fvm As fileUploadVM) As ActionResult

    Dim _filename As String = String.Empty
    For Each File As String In Request.Files
        Dim hpf As HttpPostedFileBase = TryCast(Request.Files(File), HttpPostedFileBase)
        If hpf.ContentLength = 0 Then
            Continue For
        End If
        Dim savedfileName As String = Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "\CoursePropResumes\" + Path.GetFileName(hpf.FileName)
        hpf.SaveAs(savedfileName)
        _filename = hpf.FileName
    Next

    Dim e As courseproposal = db.courseproposals.Single(Function(f) f.idCourseProposal = fvm.id)
    e.resume_file_Name = _filename
    UpdateModel(e)
    db.SaveChanges()
    Return RedirectToAction("Index")

End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:23:57+00:00Added an answer on May 27, 2026 at 9:23 am

    Your @Html.HiddenFor needs to be placed inside your form.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create ASP.NET MVC Application with Entity Framework, which has One to
I'm trying to build an ASP.NET MVC 2 application. I want to pass data
I am trying to write an ASP.NET MVC application which is a frontend to
I'm writing an ASP.NET MVC application and trying to use a RESX file to
I'm trying to pass an active directory user name in to a asp.net MVC
In my ASP.NET MVC application, I'm trying to figure out whether the user has
I'm trying to write an ASP.NET MVC application where user privilege is based upon
I am trying to upload an ASP.NET MVC application in a shared server running
I have a form within an ASP.NET MVC application and I'm trying to submit
I'm trying to make a ul/li menu in my ASP.NET MVC application. The menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.