ASP.Net Get Values ArgumentOutOfRangeException Thrown

zcc

New Member
I'm trying to loop through a gridview and save all the items in it at once. However I have a problem getting the values from the dropdownlist and textbox. I get this error each time:\[code\]ArgumentOutOfRangeException was caught. Specified argument was out of the range of valid values.\[/code\]Here's the code I'm using:\[code\]foreach (GridViewRow gvr in gvInvalidOrgs.Rows){ try { org_code = Convert.ToInt32(gvr.Cells[0].Text); division = ((DropDownList)gvr.Cells[1].Controls[0]).SelectedValue; org_description = (((TextBox)gvr.Cells[2].Controls[0]).Text); } ...}\[/code\]Both the textbox and the dropdownlists are dynamically created on rowbound if that matters.TIA
 
Back
Top