protected void btnAddParentrefDone_Click(object sender, EventArgs e) { EmailRepository emailRep = new EmailRepository(); int emailPerantId = emailRep.GetEmailPerantId(txtParentEmailRef.Text.ToString().Trim()); if (emailPerantId == -1) { txtParentEmailRef.Text = ""; return; } else { emailRep.AddParentEmailId(Convert.ToInt32(txtEmailId.Text), emailPerantId); txtParentEmailRef.Text = ""; gvEmails.DataBind(); } }