2
Answers

how to write sql server condition in jquery

suman goud

suman goud

8y
242
1
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)