//Validation protected voidGrid_deptlist_rowvalidating (Objectsender, DevExpress.Web.Data.ASPxDataValidationEventArgs e) { if(e.newvalues["Depname"] ==NULL) {adderror (e.errors, This. grid_deptlist.columns["Depname"],"department name must fill in! "); } DataTable DT=NewDataTable (); DT= Customerservicebll. Deptlist (peoid). tables[0]; for(inti =0; i < dt. Rows.Count; i++) { if(dt. rows[i]["Depname"]. ToString () = = e.newvalues["Depname"]. ToString ()) {Adderror (e.errors, This. grid_deptlist.columns["Depname"],"Sorry, the department name you entered already exists! "); } } if(E.errors.count >0) E.rowerror ="please follow the error instructions. "; }
Public authentication Methods
void Adderror (Dictionary<gridviewcolumn, string> errors, gridviewcolumn column, String errorText)
{
if (errors. ContainsKey (column)) return;
Errors[column] = ErrorText;
}
How to write Aspxgridview data validation when new modifications are written in Devexpress