Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index error @ line 4 I have marked it..
M using webusercontrol to insert Value
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
GridEditableItem editeditem = (GridEditableItem)e.Item;
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
string ID1 = editeditem.OwnerTableView.DataKeyValues[editeditem.ItemIndex]["ID"].ToString();
//HiddenField hddn = (HiddenField)userControl.FindControl("HiddenField1");
TextBox city1 = (TextBox)userControl.FindControl("TextBox1");
DropDownList ddpl1 = (DropDownList)userControl.FindControl("DropDownList1");
string updatequery = String.Format("UPDATE MST_City set City='{0}', StateID='{1}' where ID='{2}'", city1.Text, ddpl1.SelectedValue, ID1);
con.Open();
using (SqlCommand sql = new SqlCommand() { CommandText = updatequery, Connection = con })
{
sql.ExecuteNonQuery();
}
con.Close();
}