I have a controller that takes a string. In my view I hardcode the value of the input field, so it should always be the same.
public class HomeController : Controller
{
public ActionResult Index(string value)
{
return View();
}
}
@using (Html.BeginForm("Index", "Home", FormMethod.Get))
{
string value = "abcde";
@Html.TextBox("value", value)
<input type="text" name="date" value="@value" />
<input type="submit" value="Submit" />
}
If I change the value in the query string to something like ?value=12345, the @Html.Textbox value changes to the value of the querystring, instead of the value that I provided it. The other input field show the correct value.
public class HomeController : Controller
{
public ActionResult Index(string value)
{
return View();
}
}
@using (Html.BeginForm("Index", "Home", FormMethod.Get))
{
string value = "abcde";
@Html.TextBox("value", value)
<input type="text" name="date" value="@value" />
<input type="submit" value="Submit" />
}
If I change the value in the query string to something like ?value=12345, the @Html.Textbox value changes to the value of the querystring, instead of the value that I provided it. The other input field show the correct value.