views:

829

answers:

1

What I'm trying to do is pass parameters to a user control view which will update a div tag and render the new data based on a hidden user control there. I know how to update a div tag using the Ajax.Form() Helper Method but passing parameters and updating the partial control is beyond me. I've never used jQuery and looked up some tutorials on how to implement it within mvc but I've hit too many dead ends and need some help figuring out a solution. What I currently have is this and need to extend it to update the user control view.

ASPX File

<form id="formParams">
    <input name="textSearch1" type="text" />
    <input name="textSearch2" type="text" />
    <input name="btnTest" type="submit" onclick="$get('recordsForm').onsubmit()" value="Click Me" />
</form>
<% using (Ajax.Form(
            "Records",
            "Search",
            null,
            new AjaxOptions
            {
                UpdateTargetId = "records",
                OnSuccess = @"function(sender, args){}",
                HttpMethod = "GET"
            },
            new { @id = "recordsForm" }))
        {
        } 
    %>
    <div id="records">
        <img src="<%= Url.Content("~/Content/Images/load.gif") %>" alt="loading..." />
    </div>

ACSX file

<%= ViewData["searchText1"].ToString()%> is the search you entered.

Controller CS File

public ActionResult Records(string searchText1, string searchText2)
        {

            ViewData["searchText2"] = searchText2 + " Stop sucking at jQuery Ayo";
            ViewData["searchText1"] = searchText1;


            return View("Records");


        }
A: 

I figured it out.. wow all i had to do was incorporate the elements into the ajax form instead of having it in a separate form outside of it.

Ayo