dropdownlist两级联动并用gridview显示选中的详细信息 10
//绑定所有产品的大类别privatevoidBindDDLM(){DDLM.DataSource=Services.GetInstance().GetMproductt...
//绑定所有产品的大类别
private void BindDDLM()
{
DDLM.DataSource = Services.GetInstance().GetMproducttype();
DDLM.DataTextField = "Mtypename";
DDLM.DataValueField = "MproductId";
DDLM.DataBind();
BindDDLS(this.DDLM.SelectedValue.Trim());
}
//绑定所有产品的小类别
private void BindDDLS(string D_FatherId)
{
D_FatherId = Convert.ToInt32(D_FatherId).ToString();
int fid = Convert.ToInt32(D_FatherId);
DDLS.DataSource = Services.GetInstance().GetSproducttype(fid);
DDLS.DataTextField = "Stypename";
DDLS.DataValueField = "SproductId";
DDLS.DataBind();
}
//选中某一大类
protected void DDLM_SelectedIndexChanged(object sender, EventArgs e)
{
BindDDLS(this.DDLM.SelectedValue.Trim());
BindgvList();
}
//选中某一小类
protected void DDLS_SelectedIndexChanged(object sender, EventArgs e)
{
string cId = DDLS.SelectedValue.ToString();
int Sid = Convert.ToInt32(cId);
gvList.DataSource = Services.GetInstance().Getproduct(Sid);
gvList.DataBind();
}
我的代码是这样写的可是第二个dropdownlist和gridview绑定的不好,不能联动,谁能帮我解决一下?谢谢了!
我的QQ是330972926,哪位能帮我一下啊,在线等待!谢谢! 展开
private void BindDDLM()
{
DDLM.DataSource = Services.GetInstance().GetMproducttype();
DDLM.DataTextField = "Mtypename";
DDLM.DataValueField = "MproductId";
DDLM.DataBind();
BindDDLS(this.DDLM.SelectedValue.Trim());
}
//绑定所有产品的小类别
private void BindDDLS(string D_FatherId)
{
D_FatherId = Convert.ToInt32(D_FatherId).ToString();
int fid = Convert.ToInt32(D_FatherId);
DDLS.DataSource = Services.GetInstance().GetSproducttype(fid);
DDLS.DataTextField = "Stypename";
DDLS.DataValueField = "SproductId";
DDLS.DataBind();
}
//选中某一大类
protected void DDLM_SelectedIndexChanged(object sender, EventArgs e)
{
BindDDLS(this.DDLM.SelectedValue.Trim());
BindgvList();
}
//选中某一小类
protected void DDLS_SelectedIndexChanged(object sender, EventArgs e)
{
string cId = DDLS.SelectedValue.ToString();
int Sid = Convert.ToInt32(cId);
gvList.DataSource = Services.GetInstance().Getproduct(Sid);
gvList.DataBind();
}
我的代码是这样写的可是第二个dropdownlist和gridview绑定的不好,不能联动,谁能帮我解决一下?谢谢了!
我的QQ是330972926,哪位能帮我一下啊,在线等待!谢谢! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询