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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:44:12+00:00 2026-05-23T14:44:12+00:00

I am working on a questionnarie. As administrator, you are able to edit questions

  • 0

I am working on a questionnarie. As administrator, you are able to edit questions as you are viewing them.

A page with the questions can have following url:

http://localhost/Survey/DisplayQuestions/2/1

When the administrator pushes the “Edit” link, an Edit view is displayed. When the administrator pushes “Save”, i would like to redirect him to the previous site, which in this example would be:

http://localhost/Survey/DisplayQuestions/2/1

How can i accomplish this?

The Edit action looks like this:

        [HttpPost]
    public ActionResult Edit(Question question)
    {
        if (ModelState.IsValid)
        {
            db.Question.Attach(question);
            db.ObjectStateManager.ChangeObjectState(question, EntityState.Modified);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

        ViewBag.category_id = new SelectList(db.Category, "category_id", "category_name", question.category_id);
        ViewBag.type_code = new SelectList(db.Question_Type, "type_code", "type_description", question.type_code);
        return View(question);
    }

Thanks!

  • 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-23T14:44:12+00:00Added an answer on May 23, 2026 at 2:44 pm

    You have a controller “Survey” and action “DisplayQuestions”. What you basically need is to return Admin back to this action. But, as far as I see DisplayQuestions recieves some paramerers (2/1).. Since, you have to put the same parameters to restore the same state.

    I believe that Question object, contains all required info for that.. If not, it have to be extended.

    I don’t know how your model looks like, so I assume that Question contains Id, QuestionId field (just for intance)

    [HttpPost]
        public ActionResult Edit(Question question)
        {
            if (ModelState.IsValid)
            {
                // do something..
    
                return RedirectToAction("DisplayQuestions", "Survey", new { id = question.Id, questionId = question.questionId});
            }
    
            // do something else..     
            return View(question);
        }
    

    That would correctly redirect to DisplayQuestions.

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

Sidebar

Related Questions

Working on a project with git, I have two feature branches, call them dev-a
Working on THIS Page: newsite.702wedding.com/live/ Can't find where to remove the arrows at the
Working live URL showing problem: http://69.24.73.172/demos/newDemo/test.html The HTML : <div class="small-vote"> <a href="#" class="s
Working with an undisclosed API, I found a function that can set the number
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports
I'm working on a questionnaire type application in which questions are stored in a
Working in the JBoss AS portlet we have been unable to open a jsp
Working on a website http://www.ArenaText.com written in asp.net with Microsoft AJAX control toolkit. iPad
I have an after Insert trigger which is working fine when I am inserting
Working with Java Spring, how can I overwrite the default behavior of the property-placeholders

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.