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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:29:36+00:00 2026-06-03T01:29:36+00:00

Using mvc3, is there some variable to inform if I came from a Create

  • 0

Using mvc3, is there some variable to inform if I came from a Create to Edit action?

If the routing is used as well in a GET I want a certain behavior, otherwise if the CreateAction has been fired I want to open a different context Edit.

Failed first solution: Creating a extra Action Edit, fires: The current request for action 'Edit' on controller type 'XController' is ambiguous between the two action methods.

More important, is there a misinterpretation of MVC? Does this solution sound weird to anyone? I’m facing nice doubts with mvc. 🙂

  • 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-03T01:29:38+00:00Added an answer on June 3, 2026 at 1:29 am

    If you have 2 Edit methods, they must have different method inputs to differentiate them.

    public ActionResult Edit(int id)
    {
        return View(db.GetWidget(id));
    }
    
    public ActionResult Edit(int id, string username)
    {
        ViewBag.Username = username;
        return View(db.GetWidget(id));
    }
    

    Or, just make the method into one with an optional parameter

    public ActionResult Edit(int id, string username = "")
    {
        ViewBag.Username = username;
        return View(db.GetWidget(id));
    }
    

    I would also recommend painting a method attribute such as [HttpGet], [HttpPost], etc.

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

Sidebar

Related Questions

I have created a site using asp.net mvc3 and I have some action in
I'm using MVC3 .NET4.0 (VB), and I'm seeing some strange behavior on a simple
I am using mvc3 and razor is my view engine how i get date
using MVC3, Code First (DbContext) Is there a way to implement (ideally) a facade
I am using MVC3, and have some logic for changing the culture which all
Here is my dilemma, I am working on some SaaS using ASP.net MVC3 and
I am deploying a MVC3 application on IIS 7.5. There are some errors which
Using MVC3 Razor, I have a partial view with some text, two text boxes
I am developing an application using .Net MVC3 that executes some Javascript through a
I am trying to create an email link using MVC3 and strongly typed modeling.

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.