后台:
private void init()
{
DataTable gzflDt = bll.GetGZFLSelectBoxList();
Store3.DataSource = gzflDt;//工作分类
Store3.DataBind();
if (gzflDt.Rows.Count > 0)
{
this.SelectBoxgzfl.SelectedIndex = 0;
//任务分类
rwflMethod(gzflDt.Rows[0]["ID"].ToString());
}
}
/// <summary>
/// 任务分类
/// </summary>
/// <param name="gzflId"></param>
protected void rwflMethod(string gzflId)
{
DataTable rwflDt = bll.GetRWFLSelectBoxList(gzflId);
Store4.DataSource = rwflDt;//任务分类
Store4.DataBind();
if (rwflDt.Rows.Count > 0)
{
//任务分类
this.SelectBoxrwfl.SelectedIndex = 0;
}
}
protected void cbtype_change(object sender, DirectEventArgs e)
{
if (this.SelectBoxgzfl.SelectedItem.Value != "")//菜单叶子
{
rwflMethod(this.SelectBoxgzfl.SelectedItem.Value);
}
}
前台:
<td align="center" valign="middle" class="table-td6">
工作分类<font color="red">*</font>
</td>
<td align="left" valign="middle" class="table-td4">
<ext:SelectBox ID="SelectBoxgzfl" runat="server" Width="170" ValueField="ID" DisplayField="CLASSNAME">
<Store>
<ext:Store ID="Store3" runat="server">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="ID" Type="Int" />
<ext:RecordField Name="CLASSNAME" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<DirectEvents>
<Select OnEvent="cbtype_change">
</Select>
</DirectEvents>
</ext:SelectBox>
</td>
<td align="center" valign="middle" class="table-td5">
任务分类<font color="red">*</font>
</td>
<td align="left" valign="middle" class="table-td4">
<ext:SelectBox ID="SelectBoxrwfl" runat="server" Width="170" ValueField="ID" DisplayField="CLASSNAME">
<Store>
<ext:Store ID="Store4" runat="server">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="ID" Type="Int" />
<ext:RecordField Name="CLASSNAME" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
</ext:SelectBox>
</td>
实现效果图: