奇怪了 为什么运行的时候明明会显示数据 怎么
DropDownList3.SelectedItem.Text
DropDownList3.SelectedValue
都为空 郁闷 请教大家
Ajax.Utility.RegisterTypeForAjax(typeof(AjaxMethod));
AjaxMethod dbobj = new AjaxMethod();
if (!Page.IsPostBack)
{
this.DropDownList1.DataSource = dbobj.GetprovinceList();
this.DropDownList1.DataTextField = "brtype";
this.DropDownList1.DataValueField = "brtypeid";
this.DropDownList1.DataBind();
this.DropDownList1.Attributes.Add("onclick", "cityResult();");
this.DropDownList2.Attributes.Add("onclick", "areaResult();");//触发areaResult()函数
}
}
-----
function areaResult() {
var area=document.getElementById("DropDownList2");
AjaxMethod.GetAreaList(area.value,get_area_Result_CallBack);//调用访问类GetAreaList方法
}
function get_area_Result_CallBack(response)
{
if (response.value != null)
{
document.all("DropDownList3").length=0;
var ds = response.value;
if(ds != null && typeof(ds) == "object" && ds.Tables != null)
{
for(var i=0; i<ds.Tables[0].Rows.length; i++)
{
var name=ds.Tables[0].Rows[i].thtype;
var id=ds.Tables[0].Rows[i].thtypeid;
document.all("DropDownList3").options.add(new Option(name,id));
}
}
}
return
}
-------
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
public DataSet GetAreaList(int cityid)
{
string sql = "select * from tb_thirdclss where setypeid =" + cityid;
sd = dbobj.Getdateset(sql);
return sd;
}
--运行没问题 能够实现联动和显示数据 为什么DropDownList3.SelectedItem.Text
DropDownList3.SelectedValue 得不到值呢?请教!......
DropDownList3.SelectedItem.Text
DropDownList3.SelectedValue
都为空 郁闷 请教大家
Ajax.Utility.RegisterTypeForAjax(typeof(AjaxMethod));
AjaxMethod dbobj = new AjaxMethod();
if (!Page.IsPostBack)
{
this.DropDownList1.DataSource = dbobj.GetprovinceList();
this.DropDownList1.DataTextField = "brtype";
this.DropDownList1.DataValueField = "brtypeid";
this.DropDownList1.DataBind();
this.DropDownList1.Attributes.Add("onclick", "cityResult();");
this.DropDownList2.Attributes.Add("onclick", "areaResult();");//触发areaResult()函数
}
}
-----
function areaResult() {
var area=document.getElementById("DropDownList2");
AjaxMethod.GetAreaList(area.value,get_area_Result_CallBack);//调用访问类GetAreaList方法
}
function get_area_Result_CallBack(response)
{
if (response.value != null)
{
document.all("DropDownList3").length=0;
var ds = response.value;
if(ds != null && typeof(ds) == "object" && ds.Tables != null)
{
for(var i=0; i<ds.Tables[0].Rows.length; i++)
{
var name=ds.Tables[0].Rows[i].thtype;
var id=ds.Tables[0].Rows[i].thtypeid;
document.all("DropDownList3").options.add(new Option(name,id));
}
}
}
return
}
-------
[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
public DataSet GetAreaList(int cityid)
{
string sql = "select * from tb_thirdclss where setypeid =" + cityid;
sd = dbobj.Getdateset(sql);
return sd;
}
--运行没问题 能够实现联动和显示数据 为什么DropDownList3.SelectedItem.Text
DropDownList3.SelectedValue 得不到值呢?请教!......
解决方案 »
- 报Object reference not set to an instance of an object 的错 为什么?
- 网站后台加载问题,如何同步,不出现跳动
- ExtJS整合KindEditor的小毛病,该怎么解决?
- 关于DstaList中的DropDownList绑定问题
- 急!页面之间传递参数的问题????
- 同一个页面上的事件响应函数,是否保证在同一个线程中执行?
- 在MDI类型的winform中,怎么判断一个窗口已打开!若已打开,则把它置最上层!
- 蛙蛙请教:用asp.net实现CMP,如果网站特别大的话,在web.config里放很多的元数据,会不会非常影响性能呀
- 数据库连接的释放资源问题?
- 怎样安装Visual Studio .NET????????????急呀
- 如何返回值?
- 插入数据,产生乱码
然后到后台取HiddenValue的值