DropDownList的问题..搞的我头都昏了...

Suffer_Jun 2006-11-02 01:52:51
在更新的时候..小类的DropDownList永远只能取它分类的第一个值....真是奇怪了...


protected void Page_Load(object sender, EventArgs e)
{
CreateUserFolder();
if (!Page.IsPostBack)
{
ShopIsAuditing();
GetShopArea();
GetShopBigClass();
GetShopSmallClass();
}
}

#region 判断是否通过审核和注册过
private void ShopIsAuditing()
{
if (Request.Cookies["MemberName"] != null)
{
string MemberName = Request.Cookies["MemberName"].Value.ToString();
string MemberID = dal_getanyid.GetMemberID();
bool IsAuditing = dal_searchshop.GetShopInfoIsAuditing(MemberID);

//判断是否注册过店铺,如果注册过,显示编辑选项
if (dal_searchshop.SearchShopIsReged(MemberID))
{
if (IsAuditing)//判断是否经过审核
{
this.Tb_ShopName.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopName"].ToString();
this.Tb_ShopManagerName.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopManagerName"].ToString();
this.Tb_ShopAddress.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopAddress"].ToString();
this.Tb_ShopTel.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopTel"].ToString();
this.Tb_Email.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopEmail"].ToString();
this.Tb_QQ.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopQQ"].ToString();
this.Tb_Fax.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopFax"].ToString();
this.Tb_ShopCategory.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopCategory"].ToString();
this.Tb_HowtoShop.Text = dal_searchshop.GetSearchInfo(MemberID)["HowToShop"].ToString();
this.Tb_ShopURL.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopURL"].ToString();
this.Tb_ShopPhoto.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopImage"].ToString();
this.Ddl_ShopArea.SelectedValue = dal_searchshop.GetSearchInfo(MemberID)["ShopArea"].ToString();
this.Ddl_BigClass.SelectedValue = dal_searchshop.GetSearchInfo(MemberID)["ShopBelongBigClass"].ToString();
this.Ddl_SmallClass.SelectedValue = dal_searchshop.GetSearchInfo(MemberID)["ShopBelongSmallClass"].ToString();
this.Editor_ShopInfo.Text = dal_searchshop.GetSearchInfo(MemberID)["ShopInfo"].ToString();
}
else
{
utils.ThrowErrorNoJump("您的店铺还没有经过审核,所以无法修改!", "javascript:history.go(-1);");
}
}
else
{
utils.ThrowErrorNoJump("您还没有注册店铺!点击此处注册您的店铺!", "RegMyShop.aspx");
}
}
}
#endregion

#region 获得店铺地区列表
private void GetShopArea()
{
Ddl_ShopArea.DataSource = dal_searchshop.GetShopArea();
Ddl_ShopArea.DataBind();
Ddl_ShopArea.Items.Insert(0, "请选择所属地区");
}
#endregion

#region 获得店铺大类
private void GetShopBigClass()
{
Ddl_BigClass.DataSource = dal_searchshop.GetBigClass();
Ddl_BigClass.DataBind();
Ddl_BigClass.Items.Insert(0, "请选择大类");
}
#endregion

#region 获得店铺小类
private void GetShopSmallClass()
{
int BigClassID = int.Parse(Ddl_BigClass.SelectedValue);
Ddl_SmallClass.DataSource = dal_searchshop.GetSmallClass(BigClassID);
Ddl_SmallClass.DataBind();
}
#endregion

#region 通过大类获得小类
protected void Ddl_BigClass_SelectedIndexChanged(object sender, EventArgs e)
{
int BigClassID = int.Parse(Ddl_BigClass.SelectedValue);
if (Ddl_BigClass.SelectedIndex == 0)
{
Ddl_SmallClass.Enabled = false;
}
else
{
Ddl_SmallClass.Enabled = true;
}
Ddl_SmallClass.DataSource = dal_searchshop.GetSmallClass(BigClassID);
Ddl_SmallClass.DataBind();
}
#endregion

#region 指定CuteEditor用户上传文件夹
private void CreateUserFolder()
{
if (Request.Cookies["MemberName"] != null)
{
string UserName = Request.Cookies["MemberName"].Value.ToString();
Editor_ShopInfo.SetSecurityGalleryPath("~/UpLoad/Shop/" + UserName);
}
}
#endregion

#region 数据验证
private void DataIsValidate()
{
//判断店铺介绍是否为空
if (Editor_ShopInfo.Text == "" || Ddl_ShopArea.SelectedValue == "0")
{
utils.ThrowErrorNoJump("请输入店铺介绍信息", "javascript:history.go(-1);");
}
//判断数否选择所属区域
if (Ddl_ShopArea.SelectedValue == "请选择所属地区")
{
utils.ThrowErrorNoJump("请选择店铺所属地区", "javascript:history.go(-1);");
}
// 判断数否选择店铺大类
if (Ddl_BigClass.SelectedValue == "请选择大类")
{
utils.ThrowErrorNoJump("请选择店铺大类", "javascript:history.go(-1);");
}
}
#endregion

#region 保存修改信息
protected void Ib_Click(object sender, ImageClickEventArgs e)
{
DataIsValidate();
string MemberName = Request.Cookies["MemberName"].Value.ToString();
string MemberID = dal_searchshop.GetMemberID(MemberName)["ID"].ToString();
string ShopName = this.Tb_ShopName.Text.ToString();
string ShopManageerName = this.Tb_ShopManagerName.Text.ToString();
string ShopAddress = this.Tb_ShopAddress.Text.ToString();
string ShopTel = this.Tb_ShopTel.Text.ToString();
string ShopEmail = this.Tb_Email.Text.ToString();
string ShopQQ = this.Tb_QQ.Text.ToString();
string ShopFax = this.Tb_Fax.Text.ToString();
string ShopCategory = this.Tb_ShopCategory.Text.ToString();
string HowtoShop = this.Tb_HowtoShop.Text.ToString();
string ShopURL = this.Tb_ShopURL.Text.ToString();
string ShopPhoto = this.Tb_ShopPhoto.Text.ToString();
string ShopArea = this.Ddl_ShopArea.SelectedValue.ToString();
int ShopBigClass = int.Parse(Ddl_BigClass.SelectedValue);
int ShopSmallClass = int.Parse(Ddl_SmallClass.SelectedValue);
string ShopInfo = this.Editor_ShopInfo.Text.ToString();

Model.SearchShop model = new Model.SearchShop();
model.MemberID = MemberID;
model.ShopName = ShopName;
model.ShopManagerName = ShopManageerName;
model.ShopAddress = ShopAddress;
model.ShopTel = ShopTel;
model.ShopEmail = ShopEmail;
model.ShopQQ = ShopQQ;
model.ShopFax = ShopFax;
model.ShopCategory = ShopCategory;
model.HowToShop = HowtoShop;
model.ShopURL = ShopURL;
model.ShopImage = ShopPhoto;
model.ShopArea = ShopArea;
model.ShopBelongBigClass = ShopBigClass;
model.ShopBelongSmallClass = ShopSmallClass;
model.ShopInfo = ShopInfo;
dal_searchshop.Update_SearchShopInfo(model, MemberID);
utils.ThrowOK("店铺资料修改成功","EditMyShop.aspx","EditMyShop.aspx");
}
#endregion
...全文
201 7 打赏 收藏 举报
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
HJS1820 2006-11-02
  • 打赏
  • 举报
回复
太長了﹐幫頂
順便接點分。。。。
伴老思源 2006-11-02
  • 打赏
  • 举报
回复
so long

你需要几级联动?
daishengs 2006-11-02
  • 打赏
  • 举报
回复
看一下Ddl_BigClass这个控件它绑定的值是不是有错误,或者
跟踪调试到dal_searchshop.GetSmallClass(BigClassID)里面看看。
从楼主提供的这一层看不出有什么错误。
稀粪飘雪 2006-11-02
  • 打赏
  • 举报
回复
天啊!看的头都昏了.
Suffer_Jun 2006-11-02
  • 打赏
  • 举报
回复
自己解决...
sdwn1987 2006-11-02
  • 打赏
  • 举报
回复
好长看不完...
Suffer_Jun 2006-11-02
  • 打赏
  • 举报
回复
自己顶...
发帖
.NET社区

6.1w+

社区成员

.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
帖子事件
创建了帖子
2006-11-02 01:52
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。