-5

嗨如何解决这个问题?我试图在我的 rowdatabound 事件中执行此操作

protected void RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgse)
{
    if (e.Row.RowType == DataControlRowType.DataRow) {
    //If str = "0" Then
    string QNo = "";
    QNo = e.Row.Cells[0].Text;
        DataTable dtChoice_2;
        dtChoice_2 = dtChoice_2.Select("QuestionID = '" + QNo + "'").CopyToDataTable;
        RadioButtonList RadioBtnList = (RadioButtonList)e.Row.FindControl("RdChoices");
        RadioBtnList.DataSource = dtChoice_2;
    RadioBtnList.DataValueField = "ChoiceID";
    RadioBtnList.DataTextField = "ChoiceDescription";
    RadioBtnList.DataBind();
    }
}
4

1 回答 1

0

CopyToDataTable是一个方法,需要在方法名后面加上括号

dtChoice_2 = dtChoice.Select("QuestionID = '" + QNo + "'").CopyToDataTable();
                                                                           ^^^
于 2013-10-15T13:35:09.670 回答