|
[index.cshtml]
@using Syncfusion.EJ2
@model WebApplication1.Controllers.NumericValue
@using(Html.BeginForm())
{
@Html.ValidationSummary(true)
<div class="col-lg-12 control-section">
<div id="wrapper">
@Html.EJS().NumericTextBoxFor(model => model.value).Width("200px").Render()
<div>
@Html.ValidationMessageFor(model => model.value)
</div>
<div id="submitbutton">
@Html.EJS().Button("btn").Content("Post").Render()
</div>
</div>
</div>
}
[controller.cs]
public class NumericValue
{
[Required]
public int? value { get; set; }
}
public class HomeController : Controller
{
public ActionResult Index()
{
NumericValue val = new NumericValue();
val.value = 10;
return View(val);
}
[HttpPost]
public ActionResult Index(NumericValue model)
{
NumericValue val = new NumericValue();
val.value = model.value;
return View(val);
} |
|
|
|
[index.cshtml]
@using Syncfusion.EJ2
@using Syncfusion.EJ2.Inputs
@using Syncfusion.EJ2.Buttons
@model WebApplication1.Controllers.DateRange
@{
IDictionary<string, object> htmlName = new Dictionary<string, object>();
htmlName.Add("name", "rangevalue");
}
<form method="post">
@Html.EJS().NumericTextBox("numeric").HtmlAttributes(htmlName).Value(@Model.rangevalue).Render()
@Html.EJS().Button("btn").Content("submit").Render()
</form>
[controller.cs]
public class DateRange
{
[Required(ErrorMessage = "Please enter the range value")]
public string rangevalue { get; set; }
}
public class HomeController : Controller
{
public ActionResult Index()
{
DateRange tx = new DateRange();
tx.rangevalue = "2";
return View(tx);
}
[HttpPost]
public ActionResult Index(DateRange DM)
{
DateRange tx = new DateRange();
tx.rangevalue = DM.rangevalue;
return View(tx);
}
}
|
|
|
|
|