protected void btnSubmit_Click(object sender, EventArgs e) { BDocumentKind ctl = new BDocumentKind(); if (!string.IsNullOrEmpty(txtName.Text)) { ODocumentKind obj = new ODocumentKind(); obj.Name = txtName.Text; obj.Description = txtDescription.Text; try { obj.DocumentKindParent = int.Parse(ddlParent.SelectedValue); } catch (Exception ea) { obj.DocumentKindParent = 0; } if (hdfId.Value != "") { obj.DocumentKindID = int.Parse(hdfId.Value); ctl.Update(obj.DocumentKindID, obj.Name, obj.Description, obj.DocumentKindParent); hdfId.Value = ""; } else { ctl.Add(obj); } txtName.Text = ""; txtDescription.Text = ""; BindData(); } }