0
public ActionResult IndexAct()
{
    return View();
}

I want to know what this actionresult return.

I want to code something like this

public ActionResult Index()
{
    var x = IndexAct();
    var res = x.ToString();
    return View();
}

see that in this code x is first action that is called IndexAct(); Now someone please tell me how to get the result. What I actually want to do is get the response string.

Cristian Lupascu
  • 39,078
  • 16
  • 100
  • 137
user101292
  • 11
  • 1
  • 1
  • 4

1 Answers1

0

Normally you process the response in the controller using the following way:

public ActionResult IndexAct()
{
    return View();
}

[HttpPost]
public ActionResult IndexAct(string myString)
{
    // check myString here
    return ...;
}

Where myString is an input field on your form. Your IndexAct.cshtml will look like:

@using (Html.BeginForm()) {
  <fieldset>
    <legend>Question</legend>
    @Html.TextBox("myString");
  </fieldset>
}

The text typed in the textbox will be posted and available in your controller.

Gerard
  • 2,649
  • 1
  • 28
  • 46