Madhav Sharma

Madhav Sharma

  • 824
  • 892
  • 36.6k

Please short out the query

Dec 5 2013 5:42 AM
  if (rbtmale.Checked == true)
        {
            rbtngender = "male";
        }
        else if (rbtfemale.Checked == true)
        {
            rbtngender = "female";
        }
        if (txtfirstname.Text == "" || txtfirstname.Text == null)
        {
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "ScriptName", "<script type=text/javascript>alert('please field current value')</script>");
            lblName.Text = "Please Enter the First Name";     
        }
        else if (txtmiddlename.Text == "" || txtmiddlename.Text == null)
        {
            lblName.Text = "Please enter the middle name";            
        }
        else if (txtlastname.Text == "" || txtlastname.Text == null)
        {
            lblName.Text = "Please enter the last name";            
        }
        else
        {
            lblName.Text = "";
        }
        if (emailid.Text == "" || emailid.Text == null)
        {
           
            lblemailid.Text = "Please enter the emailid";
            lblName.Text = "";
        }
        else
        {
            lblemailid.Text ="";    // Hear its give error how can resolve
        }

      
        
        else
        {         
            con.Open();
            SqlCommand cmd = new SqlCommand("sp_ins_register", con);
            cmd.CommandType = CommandType.StoredProcedure;         

            cmd.Parameters.AddWithValue("@First_name", txtfirstname.Text);
            cmd.Parameters.AddWithValue("@Middle_name", txtmiddlename.Text);
            cmd.Parameters.AddWithValue("@Last_name", txtlastname.Text);
            cmd.Parameters.AddWithValue("@Email_id", emailid.Text);
            cmd.Parameters.AddWithValue("@Mob_no", txtmobileno.Text);
            cmd.Parameters.AddWithValue("@pwd", txtpassword.Text);
            cmd.Parameters.AddWithValue("@Gender", rbtngender);
            cmd.Parameters.AddWithValue("@Education", TextEducation.Text);
            cmd.Parameters.AddWithValue("@photo", fluphoto1);
            cmd.Parameters.AddWithValue("@country", ddlcountry.SelectedValue);
            cmd.Parameters.AddWithValue("@state", ddlstate.SelectedValue);
            cmd.Parameters.AddWithValue("@city", ddlcity.SelectedValue);
            cmd.Parameters.AddWithValue("@address", txtaddress.Text);

            cmd.ExecuteNonQuery();
            con.Close();
            registerbind();

            txtfirstname.Text = "";
            txtmiddlename.Text = "";
            txtlastname.Text = "";
            emailid.Text = "";
            txtmobileno.Text = "";
            txtpassword.Text = "";
            TextEducation.Text = "";
            ddlcountry.SelectedIndex = 0;
            ddlstate.SelectedIndex = 0;
            ddlcity.SelectedIndex = 0;
            txtaddress.Text = "";
            txtfirstname.Focus();
        }
}

Answers (1)