protected void AccountAddButton_Click(object sender, EventArgs e) { try { //if (AccountNameTextBox.Text.Trim().Length == 0) //{ // System.Windows.Forms.MessageBox.Show(new System.Windows.Forms.Form { TopMost = true }, "Don't accept Space char in your name"); // Focus(); //} CPT_AccountMaster accountdetails = new CPT_AccountMaster(); accountdetails.CityID = Convert.ToInt32(CityList.SelectedValue); accountdetails.AccountName = AccountNameTextBox.Text.Trim(); accountdetails.IsActive = true; AccountMasterBL insertAccount = new AccountMasterBL(); insertAccount.Insert(accountdetails); BindGrid(); CleartextBoxes(this); } catch (Exception ex) { Console.WriteLine(ex.Message); } }