suman goud

suman goud

  • NA
  • 176
  • 51.5k

how to write sql server condition in jquery

Jul 19 2016 2:05 AM
i want to change color of tree view node if Type=Master, this is my jquery
 
<script type="text/javascript">
$(document).ready(function () {
$('.treeview').change(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/Treeview/GetTreeView",
data: "{ Type: '" + $('.treeview').val() + "'}",
dataType: "json",
success: function (data) {
$(".treeview").html(data.d);
}
});
});
});
</script>
 
GetTreeView
public JsonResult GetTreeView(string term)
{
TestDemoEntities db = new TestDemoEntities();
List<string> treeView;
treeView = db.MasterNodes.Where(x => x.Name.StartsWith(term)).Select(e => e.Name).Distinct().ToList();
return Json(treeView, JsonRequestBehavior.AllowGet);
}
 
 
my table name is MasterNode,
 
where Type=Master i want to change color  
 

Answers (2)