//public bool IsUserExisiting(string sUserName) //{ // if (GetUser(sUserName) == null) // { // return false; // } // else // { // return true; // } //} //public UserPrincipal GetUser(string UserName) //{ // //const string Domain = ContextType.Domain; // //const string Username = "******"; // PrincipalContext principalContext = new PrincipalContext(ContextType.Domain); // UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(principalContext, UserName); // //UserPrincipal oUserPrincipal = UserPrincipal.FindByIdentity(oPrincipalContext, sUserName); // return userPrincipal; //} protected void grdUsers_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { ImageButton lnkDelete = grdUsers.Rows[e.RowIndex].FindControl("lnkDelete") as ImageButton; HiddenField hdfusersid = grdUsers.Rows[e.RowIndex].FindControl("hdfusersid") as HiddenField; if (lnkDelete.CommandArgument.ToString().Trim().ToUpper() == "Inactive".Trim().ToUpper()) { int afctrows; objData = new MasterData(); afctrows = objData.User_Delete(Convert.ToInt32(hdfusersid.Value.Trim())); grdfill(); divmsg.InnerHtml = "Record deleted successfully."; (this.Master as Site1).ClearModifyStatus(); } else { int afctrows; objData = new MasterData(); afctrows = objData.User_Activate(Convert.ToInt32(hdfusersid.Value.Trim())); grdfill(); divmsg.InnerHtml = "Record activated successfully."; } } catch (Exception ex) { throw ex; } }