protected void btnSave_Click(object sender, EventArgs e) { try { this.Validate("AddEdit"); if (this.IsValid) { if (gvwDetail.Rows.Count > 0) { switch (RowID) { case 0: packageProvider.Add( txtName.Text, Convert.ToInt32(ddlDuesInMonth.SelectedValue), chkIsActive.Checked, chkOpenEnd.Checked, Convert.ToDecimal(txtFreezeFee.Text), Detail); break; default: packageProvider.Update( RowID, txtName.Text, Convert.ToInt32(ddlDuesInMonth.SelectedValue), chkIsActive.Checked, chkOpenEnd.Checked, Convert.ToDecimal(txtFreezeFee.Text), Detail); break; } Refresh(); } else { WebFormHelper.SetLabelTextWithCssClass( lblMessageDetail, "Detail of package must have one or more items", LabelStyleNames.ErrorMessage); } } } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage); } }