protected void deleteLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; ProductBLL productBll = new ProductBLL(); productBll.DeleteProductById(mainProductListGridView.Rows[row.RowIndex].Cells[0].Text.ToString()); subProductDropDownList_SelectedIndexChanged(this, EventArgs.Empty); string message = "Product <span class='actionTopic'>Deleted</span> Successfully."; MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }