当前位置: 代码迷 >> ASP.NET >> 初学者~RadiobottonList有关问题
  详细解决方案

初学者~RadiobottonList有关问题

热度:7782   发布时间:2013-02-25 00:00:00.0
菜鸟求救~~RadiobottonList问题
以下是我的绑定`
  this.RadioButtonList1.DataSource = ds.Tables["voteDetails"];
  this.RadioButtonList1.DataTextField = "voteItem";
  this.RadioButtonList1.DataValueField = "voteDetailsID";
  this.RadioButtonList1.DataBind();
是绑定得了``我想实现的是~~当我单击Botton1~~~
this.Label2.Text = this.RadioButtonList1.SelectedValue.ToString();
就是取不到RadioButtonList1.SelectedValue

当用普通的不是数据绑定的RadioButtonList1又得~~
为什么绑定后会不得呢?我也有this.RadioButtonList1.DataValueField = "voteDetailsID";了啊~~没写错字~~
大家帮帮我~~急``得马上结贴!

------解决方案--------------------------------------------------------
是不是应该加一个条件
if(!ispostback)
{

}
//个人愚见。。。。不知道是不是
------解决方案--------------------------------------------------------
page_load中加上
if(!ispostback)
{

//数据绑定
}


RadioButtonList1你要没有选择是没有值的,除非有一个checked了
  相关解决方案