I have the following code snipped from my cshtml file
<div id="trows" class="table-responsive">
<table class="table table-bordered" id="myTable">
</div>
and inside the on add button event to add a row I tried as the following: -
var itemRSelected = $("#SelectedteRId option:selected").text();
var itemNSelected = $("#SelectedName option:selected").text();
debugger;
//all ok till above. I verified in debuggger
//but I am not able to add these values along with the Model rows to the table using below code. Any help? clue to fix the issue?
@{var i = 0;}
@foreach (MyNameSpace.Models.MyClassObj p in Model.myClassList)
{
if(itemRSelected == p.RowId && itemNSelected == p.NamePix) {
var row = "<tr><td>" + @(p.RowId) + "</td><td>" + @(p.NamePix) +
"</td><td>" + @(p.Mi) + "</td><td>" + @(p.Name) +
"</td><td>" + @(p.ExtraDate) +
"</td><td><a class='btn btn-danger btn-xs btnDelete' title='Delete'><i class='fa fa-trash-o'></i></a></td><tr>" ; }
@: <text>@row</text>
@:$("#myTable").eq(@i++).after(@row);
}