Hi there,
I have 2 cascading comboboxes in my form: CompanyId --> TaskId
When I select a company and there are no tasks linked to it the TaskId combobox should become disabled.
Just like it becomes disabled when I clear the CompanyId combobox.
This is what I do in the controller action:
How can I do that?
many thanks,
Chris
I have 2 cascading comboboxes in my form: CompanyId --> TaskId
When I select a company and there are no tasks linked to it the TaskId combobox should become disabled.
Just like it becomes disabled when I clear the CompanyId combobox.
This is what I do in the controller action:
01.
public
JsonResult Autocomplete(
string
query,
int
companyId) {
02.
var ret = Dao.Task.GetMany(i => i.CompanyId == companyId);
03.
04.
if
(!
string
.IsNullOrEmpty(query)) {
05.
query = query.ToLower();
06.
ret = ret.Where(i => i.Subject.ToLower().Contains(query));
07.
}
08.
09.
var res = ret.Select(i =>
new
{
10.
id = i.Id,
11.
name = i.Subject
12.
});
13.
14.
return
Json(res, JsonRequestBehavior.AllowGet);
15.
16.
}
How can I do that?
many thanks,
Chris