Exemple #1
0
 protected void ValidateCommunityName(object sender, ServerValidateEventArgs e)
 {
     if (this.AccessMode == Common.AccessMode.Insert)
     {
         IDataReader idr = null;
         try
         {
             idr = HitblCommunityCty.FetchByParameter(HitblCommunityCty.Columns.CtyVirtualUrl, SubSonic.Comparison.Like, e.Value);
             if (idr.Read())
             {
                 e.IsValid = false;
                 ScriptManager.RegisterStartupScript(UpnlCommunity, UpnlCommunity.GetType(), "SetFocus", String.Format("document.getElementById('{0}_text').focus();", this.txtCommName.ClientID), true);
             }
         }
         catch
         {
         }
         finally
         {
             if (idr != null && !idr.IsClosed)
             {
                 idr.Close();
             }
         }
     }
     else
     {
         e.IsValid = true;
     }
 }
Exemple #2
0
        protected void txtCommName_TextChanged(object sender, EventArgs e)
        {
            IDataReader idr         = null;
            string      strCommName = txtCommName.Text;

            try
            {
                idr = HitblCommunityCty.FetchByParameter(HitblCommunityCty.Columns.CtyVirtualUrl, SubSonic.Comparison.Like, strCommName);
                if (idr.Read())
                {
                    lblNameExists.Visible = true;
                    txtCommName.Text      = string.Empty;
                }
                else
                {
                    lblNameExists.Visible = false;
                }
            }
            catch
            {
            }
            finally
            {
                if (idr != null && !idr.IsClosed)
                {
                    idr.Close();
                }
            }
        }