baskaran chellasamy

baskaran chellasamy

  • NA
  • 114
  • 150.2k

cannot read the data from gridview column

Oct 3 2013 6:16 AM
Hi friends the following is my code for read the cell value from gridview. when i read it return null for cell value. but gridview has the value for the particular cell.

public bool inserstumark(Commonpropertis comp, System.Web.UI.WebControls.GridView grid)
        {
            bool result = false;
            if (comp.EXAMNAMES != "Annual Exam" || comp.EXAMNAMES!="Half yearly Exam"|| comp.EXAMNAMES!="Quartely Exam" )
            {
                int rows = grid.Rows.Count;
                for (int i = 0; i < rows; i++)
                {
                  //  comp.ADMISSIONNUMBER = Convert.ToInt32(grid.Rows[i].Cells[0].Text);
                    System.Web.UI.WebControls.Label lbl = grid.Rows[i].FindControl("lblrollno") as System.Web.UI.WebControls.Label;
                    comp.ROLLNUMBER = lbl.Text;
                   // comp.NAME = grid.Rows[i].Cells[2].Text;
                    System.Web.UI.WebControls.TextBox txt = grid.Rows[i].FindControl("mark2txt") as System.Web.UI.WebControls.TextBox;
                    comp.EXTERNALMARK =Convert.ToInt32(txt.Text);
                    result= userdao.inserstumark1(comp);
                }
                return result;
            }
        

Answers (1)