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

  • Home
  • SEARCH
  • 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 8462719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:14:45+00:00 2026-06-10T14:14:45+00:00

Have a problem. For add new vacancy in my project I using K-MVC public

  • 0

Have a problem. For add new vacancy in my project I using K-MVC

public ActionResult AddVacancy()
{
    var viewModel=new VacancyViewModel();
    viewModel.AllTechnologies = (from t in _serviceClient.GetTechnologies() select t.Name).ToList();
    return View(viewModel);
}

[HttpPost]
public ActionResult AddVacancy(VacancyViewModel viewModel)
{
     _serviceClient.AddVacancy(viewModel);
     return Json(viewModel);
} 

//————————————————————————————–

@using PerpetuumSoft.Knockout
@model Core.ViewDataModel.VacancyViewModel
@{
    var ko = Html.CreateKnockoutContext();
    ViewBag.Title = "New vacancy";
}
...............................
@using (ko.Html.Form("AddVacancy", "Vacancy", ko.Model))
{
...............................................        
<p>
            <input class="submitButton" type="submit" value="Create" />
        </p>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@ko.Apply(Model)

All works fine! Thanks K-MVC!
But, if I want to redirect to another action after successful submition :

[HttpPost]
        public ActionResult AddVacancy(VacancyViewModel viewModel)
        {
             _serviceClient.AddVacancy(viewModel);
             return RedirectToAction("Index"); 
        } 

I’ll receive error, because previous form don’t receive Ajax.success. How can I manage this problem?
Thanks in advance!

  • 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-10T14:14:47+00:00Added an answer on June 10, 2026 at 2:14 pm

    I still don’t find a solution but make interface more informative to user without redirection

        @using (ko.If(m => m.SavedSuccessfully))
    {
        @ko.Html.Span("NEW VACANCY SAVED TO DATABASE.")
    }
    
    @using (ko.If(m => m.SavedSuccessfully == false))
    {
         using (ko.Html.Form("AddVacancy", "Vacancy", ko.Model))
         {
             <p>@Html.Label("Name: ")            @ko.Html.TextBox(m => m.Name).ValueUpdate(KnockoutValueUpdateKind.AfterKeyDown) </p>
             <p>@Html.Label("Active : ")         @ko.Html.CheckBox(m => m.IsOpen).ValueUpdate(KnockoutValueUpdateKind.Change) </p>
             <p>@Html.Label("English: ")         @ko.Html.DropDownList(m => m.AllLanguageLevels).Value(m => m.EnglishLevel) </p>
             <p>@Html.Label("German: ")          @ko.Html.DropDownList(m => m.AllLanguageLevels).Value(m => m.GermanLevel) </p>
             <p>@Html.Label("Technologies: ")    @ko.Html.ListBox(m => m.AllTechnologies).SelectedOptions(m => m.NeededTechnology) </p>
             <p>
                 <input class="submitButton" type="submit" value="Submit" />
             </p>
         }
    }
    

    and controller:

            [HttpPost]
        public ActionResult AddVacancy(VacancyViewModel viewModel)
        {
            if(ModelState.IsValid)
            {
                _serviceClient.AddVacancy(viewModel);
                viewModel.SavedSuccessfully = true;
            }
            return Json(viewModel);
        }
    

    And now if vacancy saved successfully – form hides and information “NEW VACANCY SAVED TO DATABASE.” appears.

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

Sidebar

Related Questions

I have a problem with viewmodel, when I try to add new enregistrement to
I have problem on my blog: http://osify.com while processing add new post with above
I have problem with store data in list collection. If I add new data
I have the problem: I can not add new item to the same combobox
I have problem with add new row to the table. I use Google Maps,
i have a problem to add a new attribute to an existing html string.
I have problem to add jQuery to some existing code, please help. We have
I have a problem: I've add a Jquery UI drag-n-drop widget to my page,
I have problem, when I want add Node to my GUI from other Thread.
I have a problem where I have to add thirty-three integer vectors of equal

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.