2
Reply

how to write sql server condition in jquery

suman goud

suman goud

Jul 19 2016 2:05 AM
221
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)