So I am very new ASP.NET MVC, I took an intro ASP.NET months and months ago, and have unfortunately forgotten nearly everything :(

I have been given a task to add a lookup button to a page that takes in a username from a textbox and verifies whether or not that username is valid. Image

enter image description here

I have spent hours and hours trying to get it to work. Unfortunately what i realllyyy need to do is sit down for a few weeks and re-teach myself and learn javascript, jquery, mvc. I am going to learn it all, but this assignment is to small and specific to spend weeks learning languages and frameworks just to begin solving.

Here is where i'm at:

Structure of Controller:

public class NewUserRequestController : Controller
    // GET: NewUserRequest
    public ActionResult Index()
        return View(new NewUserRequest());

    public ActionResult LookupLDN(ITFormsLibrary.NewUserRequest req)
        //Code that Verifies user etc
        return View(req);

    public ActionResult Submit(ITFormsLibrary.NewUserRequest req)
            //Code that handles submission validation & errorvalidation 
            return View("Index", req);

Now in the view, I have tried messing around with:

@using((Ajax.BeginForm("LookupLDN", "NewUserRequest", FormMethod.Post, new AjaxOptions { UpdateTargetId = "NewUserIfo"}, new { @class = "form-inline", role = "form" }))

Only to discover I can't nest forms.

I have tried:

@Ajax.ActionLink("Lookup", "LookupLDN", "NewUserRequest", new { Model},null, new { @class = "form-inline", role = "form" })


@HTML.ActionLink("Lookup", "LookupLDN", "NewUserRequest", new { Model})

both of which return 404 for some reason.

I have also tried:

<input type="button" value="Lookup" onclick="return lookupLDN()"/>

But, I don't know how to construct a javascript statement to handle an asynchronous POST? - Should I even be trying to POST?

If any of you understand what I am trying to accomplish and can provide help, I would be extremely grateful. thank you!

Related posts

Recent Viewed