protected void btnsave_Click(object sender, EventArgs e) { int id = 0; if (ViewState["ID"] != null) { id = Convert.ToInt32(ViewState["ID"]); } _vendor = new Vendor.BO.Vendor().GetData(id); try { RefreshObject(); _vendor.Save(); _message.Text = "Data Saved Successfully"; _message.CssClass = "MessageSuccess"; if (id > 0) { Response.Redirect("VendorList.aspx"); } else { _vendor = new Vendor.BO.Vendor(); RefreshControl(); } } catch (Exception exp) { _message.Text = exp.Message; _message.CssClass = "MessageError"; } }
protected void Page_Load(object sender, EventArgs e) { _message = (Label)Master.FindControl("lblMessage"); Label header = (Label)Master.FindControl("lblHeader"); header.Text = "Vendor Detail"; if (!IsPostBack) { int id = 0; if (Page.Request.QueryString["ID"] != null) { id = Convert.ToInt32(Page.Request.QueryString["ID"]); } ViewState["ID"] = id; _vendor = new Vendor.BO.Vendor().GetData(id); RefreshControl(); } }