protected void linkDeleteTriggerModal_Click(object sender, EventArgs e) { int ProductTypeID = Convert.ToInt32((sender as LinkButton).CommandArgument); int ConflictedData = new ProductTypeHandler().IsConflictedData(ProductTypeID); HdnProductTypeId.Value = "0"; //no conflicted data if (ConflictedData == 0) { Btn_DeleteProductType.Visible = true; HdnProductTypeId.Value = ProductTypeID.ToString(); lblModalBody.Text = "Are You sure you want to delete this item?"; } else { Btn_DeleteProductType.Visible = false; lblModalBody.Text = String.Format("Cannot Delete this Item, there is/are {0} item/s using this item!", ConflictedData.ToString()); } ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#DeleteModal').modal();", true); }