如何从gridview readonly列读取列数据

时间:2013-08-22 09:25:25

标签: c# asp.net gridview

我正在尝试读取gridview只读列的列值。但它会将错误视为 指定的参数超出了有效值的范围以下是我在asp.net gridview中的rowupdate事件中的代码

 protected void branchgrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            comp.ADMISSIONNUMBER = Convert.ToInt32((TextBox)studacgrid.Rows[e.RowIndex].FindControl("AdmissionNumber"));
        //comp.ADMISSIONNUMBER = Convert.ToInt32(studacgrid.Rows[e.RowIndex].Cells[1]
        comp.MEDIUM =Convert.ToString ((TextBox)studacgrid.Rows[e.RowIndex].FindControl("Medium"));
        comp.CLASSNAME =Convert.ToString ((TextBox)studacgrid.Rows[e.RowIndex].FindControl("Class"));
        comp.ACADAMICYEAR = Convert.ToString((TextBox)studacgrid.Rows[e.RowIndex].FindControl("Academicyear"));
        comp.SECTIONNAME = Convert.ToChar(((TextBox)studacgrid.Rows[e.RowIndex].Cells[7].Controls[0]).Text.ToString());

       }

0 个答案:

没有答案