悬赏分:10 浏览:501 次
在updatepanel里面的三个下拉框初始化的时候为什么取不到值呢?
代码如下:
private void BindCountry()
{
//绑定下拉框
NewsClass.t_set_countryClass countrylib = new NewsClass.t_set_countryClass();
DataSet dsCountry = countrylib.GetList("1=1 ");
this.DdlCountry.DataSource = dsCountry;
this.DdlCountry.DataBind();
if (null != dsCountry)
{
NewsClass.ProvinceClass provincelib = new NewsClass.ProvinceClass();
DataSet dsprovince = provincelib.GetList(" 1=1 and [Country_Id]='" + this.DdlCountry.SelectedValue.ToString() + "'");
this.DdlProvince.DataSource = dsprovince;
this.DdlProvince.DataBind();
if (dsprovince != null)
{
NewsClass.CityClass citylib = new NewsClass.CityClass();
DataSet dsCity = citylib.GetList(" 1=1 and [Province_Id]='" + this.DdlProvince.SelectedValue.ToString() + "'");
this.DdlCity.DataSource = dsCity;
this.DdlCity.DataBind();
}
}
}
this.DdlCountry.SelectedValue.ToString() 取到的是'System.Data.DataRowView'
错误提示是:
将varchar 值 'System.Data.DataRowView' 转换为数据类型为 int 的列时发生语法错误
可是在没有用updatepanel的时候就能够取到。
是需要设置什么吗?还是怎么样呐?
麻烦大家帮帮忙....