See code example below.... I currently have two dropdown lists that are linked together as cascading dropdowns. In the case where the second dropdown (that is dependant ont he first dropdown) only gets one value populated to it I would like it to be autoselected instead of making the user select the single value that gets placed in that dropdown.
However, if the second dropdown gets populated with more than one value, then I would like the placeholder text to show as it does today.
Any ideas on how to best go about achieving this? FYI, this is currently set up so that the second dropdown list is disabled until a value is selected from the first. I figured this out but can't figure out the autoselecting of the second dropdown if only one value.
Thanks,
Jason
<!-- START ACTIVITY TYPE -->
<div class="span3">
<span class="activity-label">Activity Type</span>
<div class="row-fluid">
@(Html.Kendo().DropDownList()
.Name(String.Format("MCActivityTypeId{0}", i))
.OptionLabel("Select Activity Type...")
.HtmlAttributes(new { @class = "span12 case_mc_activityTypeId" })
.DataValueField("WorkflowQueueActivityMapId")
.DataTextField("ActivityName")
.DataSource(ds =>
{
ds.Read(r => r.Action("ActivityTypeData", "Workdriver", new { Id = act.WorkflowQueueId }));
}
)
.Enable(showChargeIntegrityEditAddNew && act.IsDataEntry)
)
</div>
</div>
<!-- END ACTIVITY TYPE -->
<!-- START ACTIVITY STATUS -->
<div class="span3">
<span class="activity-label">Activity Status</span>
<div class="row-fluid">
@(Html.Kendo().DropDownList()
.Name(String.Format("MCActivityStatus{0}", i))
.OptionLabel("Select Activity Status...")
.HtmlAttributes(new { @class = "span12 case_mc_activityStatusId" })
.DataValueField("WorkflowQueueActivityStatusMapId")
.DataTextField("ActivityStatusName")
.DataSource(ds =>
{
ds.Read(r =>
{
r.Action("ActivityStatusData", "Workdriver")
.Data(@<text>function() { return { id: $('#MCActivityTypeId@(i)').val() }; }</text>);
}).ServerFiltering(true);
}
)
.Enable(false)
.AutoBind(false)
.CascadeFrom(String.Format("MCActivityTypeId{0}", i))
)
</div>
</div>
<!-- END ACTIVITY STATUS -->
However, if the second dropdown gets populated with more than one value, then I would like the placeholder text to show as it does today.
Any ideas on how to best go about achieving this? FYI, this is currently set up so that the second dropdown list is disabled until a value is selected from the first. I figured this out but can't figure out the autoselecting of the second dropdown if only one value.
Thanks,
Jason
<!-- START ACTIVITY TYPE -->
<div class="span3">
<span class="activity-label">Activity Type</span>
<div class="row-fluid">
@(Html.Kendo().DropDownList()
.Name(String.Format("MCActivityTypeId{0}", i))
.OptionLabel("Select Activity Type...")
.HtmlAttributes(new { @class = "span12 case_mc_activityTypeId" })
.DataValueField("WorkflowQueueActivityMapId")
.DataTextField("ActivityName")
.DataSource(ds =>
{
ds.Read(r => r.Action("ActivityTypeData", "Workdriver", new { Id = act.WorkflowQueueId }));
}
)
.Enable(showChargeIntegrityEditAddNew && act.IsDataEntry)
)
</div>
</div>
<!-- END ACTIVITY TYPE -->
<!-- START ACTIVITY STATUS -->
<div class="span3">
<span class="activity-label">Activity Status</span>
<div class="row-fluid">
@(Html.Kendo().DropDownList()
.Name(String.Format("MCActivityStatus{0}", i))
.OptionLabel("Select Activity Status...")
.HtmlAttributes(new { @class = "span12 case_mc_activityStatusId" })
.DataValueField("WorkflowQueueActivityStatusMapId")
.DataTextField("ActivityStatusName")
.DataSource(ds =>
{
ds.Read(r =>
{
r.Action("ActivityStatusData", "Workdriver")
.Data(@<text>function() { return { id: $('#MCActivityTypeId@(i)').val() }; }</text>);
}).ServerFiltering(true);
}
)
.Enable(false)
.AutoBind(false)
.CascadeFrom(String.Format("MCActivityTypeId{0}", i))
)
</div>
</div>
<!-- END ACTIVITY STATUS -->