i have astrange problem with my register page i have a clander which works fine but after i add acode to check user and email if available or not in database its impossble to work only work when i make refresh to the page or start with datetime clander before write the username or email
even loading gif doesnt work
this is my code
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="register.ascx.cs" Inherits="UserControl_register" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
Register on my site
Your Personal Information
Your E_mail
Your Password
Your Address
Phone
Birthday
Gender
Security Question
This site is powered ##O>
the code behind
public partial class UserControl_register : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnregister_Click(object sender, EventArgs e)
{
if (chbaccept !=null && chbaccept.Checked) // to check if he accept the terms or not
{
Member m = new Member();
lbl_msg.Text = m.Register(Txtusername.Text, Txtemail.Text, Txtpassword.Text, ddlcountry.SelectedValue, Txtaddress.Text, Txtphone.Text, Convert.ToDateTime(Txtbirthday.Text), ddlgender.Text, ddlsecurityQuestion.SelectedValue, Txtanswer.Text);
//Clear();
}
else
{
lbl_msg.Text = "please accept the terms";
}
}
protected void Txtusername_TextChanged(object sender, EventArgs e)
{
Member user = new Member();
if (!string.IsNullOrEmpty(Txtusername.Text))
{
if (user.Emailavi(Txtusername.Text))
{
ImgUser.ImageUrl = "../NotAvailable.gif";
lbl_msg.Text = "NotAvailable user";
lbl_msg.ForeColor = System.Drawing.Color.Red;
Txtusername.Focus();
}
else
{
ImgUser.ImageUrl = "../Icon_Available.gif";
lbl_msg.Text = "Available user";
lbl_msg.ForeColor = System.Drawing.Color.Green;
}
}
}
protected void Txtemail_TextChanged(object sender, EventArgs e)
{
Member emailcheck = new Member();
if (!string.IsNullOrEmpty(Txtemail.Text))
{
string email = Txtemail.Text;
Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
Match match = regex.Match(email);
if (match.Success)
{
if (emailcheck.Emailavi(Txtemail.Text))
{
Imgemail.ImageUrl = "../NotAvailable.gif";
lbl_msg.Text = "NotAvailable email";
lbl_msg.ForeColor = System.Drawing.Color.Red;
}
else
{
Imgemail.ImageUrl = "../Icon_Available.gif";
lbl_msg.Text = "Available email";
lbl_msg.ForeColor = System.Drawing.Color.Green;
}
}
else
Imgemail.ImageUrl = "../NotAvailable.gif";
lbl_msg.Text = "Not vaild email";
lbl_msg.ForeColor = System.Drawing.Color.Red;
Txtemail.Focus();
}
else
{
lbl_msg.Text = "Please enter an email";
lbl_msg.ForeColor = System.Drawing.Color.Red;
Txtemail.Focus();
}
}
}
Sanjeeb LenkaPosted Jul 18, 2013, 2:52 PM
just check this sample for multiple textbox validation:
in aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
in .cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
CleartextBoxes(this);
}
public void CleartextBoxes(Control parent)
{
foreach (Control c in parent.Controls)
{
if ((c.GetType() == typeof(TextBox)))
{
if (((TextBox)(c)).Text == string.Empty)
{
Label1.Text = "text box is blank";
}
else
{
Label1.Text = "all are filled";
}
}
if (c.HasControls())
{
CleartextBoxes(c);
}
}
}
}
alaaPosted Jul 18, 2013, 7:44 PM
alaaPosted Jul 18, 2013, 1:58 PM
{Iftikar HussainPosted Jul 18, 2013, 11:08 AM
Regards,
Iftikar
Sanjeeb LenkaPosted Jul 18, 2013, 10:55 AM
if you select current date then you can get the time by code in back end. just think how will you get the time of past and future date on selection.
just give your clear requirement details. so we can able to solve your problem.
alaaPosted Jul 18, 2013, 9:08 AM
Iftikar HussainPosted Jul 18, 2013, 6:59 AM
OnClientDateSelectionChanged="dateselect"
Regards,
Iftikar
Sanjeeb LenkaPosted Jul 18, 2013, 6:54 AM
you want date or date time bothh.
Iftikar HussainPosted Jul 18, 2013, 6:41 AM
Regards,
Iftikar
alaaPosted Jul 18, 2013, 6:35 AM
i use VS2012
Iftikar HussainPosted Jul 18, 2013, 6:18 AM
Regards,
Iftikar
alaaPosted Jul 18, 2013, 6:16 AM
Iftikar HussainPosted Jul 18, 2013, 5:12 AM
in your control
Regards,
Iftikar
Sanjeeb LenkaPosted Jul 18, 2013, 5:02 AM
alaaPosted Jul 18, 2013, 4:58 AM
Sanjeeb LenkaPosted Jul 18, 2013, 12:46 AM
sample:
Iftikar HussainPosted Jul 18, 2013, 12:27 AM
Try to use directly the ajaxtoolkit calendar control
Regards,
Iftikar