Thursday, January 26, 2012

Using DataTable.select function for selecting from datatable

        DataTable dt = ((DataTable)ViewState["dtNewStudents"]);
        DataRow[] EditRows = dt.Select("Edit='1'");
        
        for(int i=0; i Less than EditRows.Count(); i++)
        {
            int index = dt.Rows.IndexOf(EditRows[i]);
            dt.Rows[index]["Edit"] = "0";
        }
        ViewState["dtNewStudents"] = dt;

No comments:

Post a Comment