T4MVC and Ajax method with parameter

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2012-05-05T16:29:41Z Indexed on 2012/06/16 21:16 UTC
Read the original article Hit count: 191

Filed under:
|

I am trying to apply T4MVC to my project. Say, I have an ajax search box, it calls Home/SearchQuery action which takes in a string q as parameter. How do I write that line in T4MVC?

From Ajax.BeginForm("SearchQuery", "Home", .... To Ajax.BeginForm(MVC.Home.SearchQuery(???)...

.cshtml file

@using (Ajax.BeginForm("SearchQuery", "Home", /* <-----Convert to T4MVC Here */
        new AjaxOptions {
            LoadingElementId = "loadingGif",
            OnSuccess = "parseResults",
            OnFailure = "searchFailed"
        })) {
    <input type="text" name="q" />
    <input type="submit" value="Search" />
    <img id="loadingGif" style="display:none" src="@Url.Content("~/content/images/loading.gif")" />
}

<div id="searchResults" style="display: table"></div>

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about T4MVC