my model code
public class viewCase
{
public List<string> lstCategory { get; set; }
public DataTable dtWrkTsk { get; set; }
}
my controller code
string query = "SELECT WorkFlowID,Subject,Category FROM CMSTasksWorkFlow"
objcase.dtWrkTsk = objdataclas.ExecuteDataTable(query);
return View("../ViewCases/CasesScreen",objcase);
my cshtml code
function getCaption() {
var cat= $("#layout option:selected").text(); //variable for select condition
var arr = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(
Model.dtWrkTsk.Select("Catagory='" + cat + "'") )); //<- error here
}
its giving me error 'cat ' does not exist in current context
and if i try
function getCaption() {
var cat= $("#layout option:selected").text(); //variable for select condition
var arr = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(
Model.dtWrkTsk.Select("Catagory='" +@<text> cat </text> + "'") ));} //<- error here
CS1660: Cannot convert lambda expression to type 'string' because it is not a delegate type
<div id="addTask" class="modal fade " aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content round">
<div class="modal-header"><h4>New Task </h4></div>
<div id="tbody" class="modal-body" style="height:20%">
@Html.DropDownList("layout", Model.lstCategory.Select(m => new SelectListItem { Text = m, Value = m }), "All", new { onclick = "getCaption()" })
<div id="dtask" style="width: 80%; overflow: scroll; ">
</div>
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary" >OK</button>
<button type="button" data-dismiss="modal" class="btn">Cancel</button>
</div>
</div>
</div>
</div>
i am trying to keep datatable disconnected from server so whenever user changes value in Html.DropDownList
function getCaption()
is called
i only need select condition in datatable where i select category with javascript varible passing
how do i pass my javascript variable in datatable.select