在GridView中取RadioButtonList值时候 提示 输入字符串格式不正确
protected void btnSubmit_Click(object sender, EventArgs e){
DateTime now = System.DateTime.Now;
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
if (GridView1.Rows[i].RowType == DataControlRowType.DataRow)
{
RadioButtonList rbl = this.GridView1.Rows[i].Cells[0].FindControl("rblOptionList") as RadioButtonList;
//option.QuestionId = Convert.ToInt32(this.gvQuestionList.DataKeys[e.Row.RowIndex].Value);
//string s = rbl.SelectedItem.Text;
vote.OptionId = Convert.ToInt32(rbl.SelectedValue);//输入字符串格式不正确
vote.AddedDate = now;
vote.UserIP = HttpContext.Current.Request.UserHostAddress;
vote.Save();
question.QuestionId = Convert.ToInt32(this.GridView1.DataKeys[i].Value);
question.UpdateVoteNum();
}
}
WebHelper.Alert("投票成功");
}
补充:.NET技术 , ASP.NET