protected void btnAdd_Click(object sender, EventArgs e) { userid = (int)Session["UserId"]; DataTable dt = blc.SearchbyExpenseCatName(txtCategory.Text, userid); if (dt.Rows.Count > 0) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Category already exists.');", true); txtCategory.Text = string.Empty; txtCategory.Focus(); } else { int i = blc.InsertExpenseCategory(txtCategory.Text, 1, userid); if (i > 0) { loadCategories(); txtCategory.Text = string.Empty; } } }