public void grdalternatives_DeleteCommand(object sender, DataGridCommandEventArgs e) { String DetailId = ""; DetailId = grdalternatives.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString(); contingency _wc = new contingency(); _wc.Deletealternatives(Convert.ToInt32(DetailId)); BindAlternatives(Convert.ToInt32(ViewState["EstNum"].ToString())); //Server.Transfer("whitfield_estimation.aspx?EstNum=" + ViewState["EstNum"].ToString()); }