0 sandeep sir ...this is my all code And I also add script FROM CDN
View:-
@using (Html.BeginForm("CreateCategory", "CategoryAndSubCategory", FormMethod.Post, new { enctype = "multipart/form-data", @id = "category" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@*
@Html.LabelFor(model => model.Category, htmlAttributes: new { @class = "control-label col-md-2 required" })
@Html.EditorFor(model => model.Category, new { htmlAttributes = new { @class = "form-control", @placeholder = "Enter Category Name", @onKeyPress = "return ValidateAlphaComma(event);" } })
@Html.ValidationMessageFor(model => model.Category, "", new { @class = "text-danger" })
*@
@*
*@
@if (Model != null && Model.Count > 0)
{
int j = 0;
foreach (var i in Model)
{
@*
*@
j++;
}
}
Category ID | Category | |
---|
@Html.TextBoxFor(a => a[j].CategoryId) | @Html.TextBoxFor(a => a[j].Category) | @if (j > 0) { Remove } |
}
<!-- Inject Script Filtered -->
<!-- Inject Script Filtered -->
<!-- Inject Script Filtered -->
<!-- Inject Script Filtered -->
<!-- Inject Script Filtered -->
Controller:-
[HttpGet]
public ActionResult CreateCategory()
{
List ci = new List { new CategoryViewModel { Category = "" } };
return View(ci);
}
0 For this purpose
add script FROM CDN
<!-- Inject Script Filtered -->
For more details please refer: My personal blog
https://sandippatilprogrammer.wordpress.com/2013/11/29/jquery-live-method/
Please let me know ...wheather it's found useful or not