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 8567311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:51:11+00:00 2026-06-11T17:51:11+00:00

so I have a Url Action <a href=@Url.Action(Create,Teacher, new { createAndAssign = true, teacherID

  • 0

so I have a Url Action

<a href="@Url.Action("Create","Teacher", new { createAndAssign = true, teacherID = Model.AccountID })">Create new teacher & assign to account.</a>

That passes in two routeValues: createAndAssign, and teacherID.

Now when I go to my Teacher/Create page, my URL is like so:

.../Teacher/Create?createAndAssign=True&teacherID=ea817321-5633-4fdc-b388-5dba2c4a728e

Which is good, I want this. Now when I POST to create my teacher, how do I grab createAndAssign and teacherID value?

  • 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-06-11T17:51:13+00:00Added an answer on June 11, 2026 at 5:51 pm

    You can set the Querystring value in a hidden variables in the form and render in your GET action method and accept that in your POST action method.

    View rendered by your GET Action

    @using (Html.BeginForm())
    {
     //Other form elements also
      @Html.Hidden("teacher",@Request.QueryString["teacherID"] as string)
      @Html.Hidden("createAndAssign",@Request.QueryString["createAndAssign"] 
                                                                        as string)
      <input type="submit" />
    }
    

    and now have a teacher parameter and createAndAssign parameter in your HttpPost action method so that it will be available when you submit the form.

    [HttpPost]
    public ActionResult Create(string teacher,string createAndAssign)
    {
         //Save and Redirect      
    }
    

    If your view is strongly typed (which is my personal preference), it is quite easy,

    public ActionResult GET(string teacherID,string createdAndAssing)
    {
       var yourVMObject=new YourViewModel();
       yourVMObject.TeacherID=teacherID;
       yourVMObject.CreateAndAssign=createdAndAssing;
       return View(createdAndAssing);
    }
    

    and in your strongly typed view,

    @model YourViewModel
    @using (Html.BeginForm())
    {
     //Other form elements also
      @Html.HiddenFor(x=>x.TeacherID)
      @Html.HiddenFor(x=>x.CreateAndAssign)                                     
      <input type="submit" />
    }
    

    And in your POST action

    [HttpPost]
    public ActionResult Create(YourViewModel model)
    {
         //look for model.TeacherID
         //Save and Redirect      
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my code, I have the following: <ul> .. <li><a href=@Url.Action(SplEdit, Spk, new {
I have a url, something like this localhost:8080/foo.action?param1=7&param2=8&param3=6 When this is the Url (as
I am having problem with overriding Form Action URL I have a class to
I'm sure I have seen this syntax <%= Url.Action((MyController c) => c.MyMethod(a)) %> or
I have an URL like this /home/action/id How can I access this id in
I have an url domain.com/a which redirects to domain.com/controller/action/a . How do I get
I have a url http:// * .com/branch/module/view/id/1/cat/2/etc/3. It becomes. array ( 'module'=>'branch', 'controller'=>'module', 'action'=>'view'
I have a problem with Jquery function getJSON, the action url does not trigger
I want to have possibility to access action by the following URL type: http://localhost/MyControllerName/MyActionName/Id1+Id2+Id3+Id4
i have an ajax call $.ajax({ url: '<%=Url.Action(SaveDetails,Survey) %>', dataType: 'JSON', cache: false, data:

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.