asp.net - Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index gridview -


my grid has 1 row (always) based on unique condition in database. when try edit using rowcommand getting error

"index out of range"

here grid code , asp.net code:

protected void grdedittemplate_rowcommand(object sender, gridviewcommandeventargs e) {     if (e.commandname == "update") {         int index = e.commandargument;         label l0 = (label) grd.rows[index].cells[0].controls[1];         value.text = l0.text;         label l1 = (label) grd.rows[index].cells[1].controls[1];         value1.text = l1.text;         label l2 = (label) grd.rows[index].cells[2].controls[1];         value2.text = l2.text;         label l3 = (label) grd.rows[index].cells[3].controls[1];         value3.text = l3.text;         label l4 = (label) grd.rows[index].cells[4].controls[1];         value4.text = l4.text;         label l5 = (label) grd.rows[index].cells[5].controls[1];         value5.text = .text label l6 = (label) grd.rows[index].cells[6].controls[1];         value6.text = l6.text;     } } 


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -