protected void Button1_Click(object sender, EventArgs e) { if (Page.IsValid) { nszillow.clsfetprp objprp = new nszillow.clsfetprp(); nszillow.clsfet obj = new nszillow.clsfet(); objprp.fetdsc = TextBox1.Text; try { obj.Save_Rec(objprp); } catch { } GridView1.DataBind(); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "deleteRow") { nszillow.clsfetprp objprp = new nszillow.clsfetprp(); nszillow.clsfet obj = new nszillow.clsfet(); objprp.fetcod = Convert.ToInt32(e.CommandArgument); try { obj.Delete_Rec(objprp); } catch (SqlException exp) { if (exp.Class == 16) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Error: Cannot Delete Feature! As Feature is Not Null ')", true); } } GridView1.DataBind(); } }