Show Hide Button based on condition using C# in ASP.Net

Last Reply one month ago By itsme

Posted one month ago

I am trying to show update button if company has filled his profile form once after login but when company has not filled profile form not at all then show button should be shown to the company.

    public partial class Company_profile : System.Web.UI.Page
    {
        SqlConnection mycon = new SqlConnection(ConfigurationManager.ConnectionStrings["Q_SS_regnConnectionString1"].ToString());
        SqlCommand cmd = new SqlCommand();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                mycon.Open();
                cmd.Connection = mycon;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "Select Name,email from Common_regn2 where email='" + Session["mail"].ToString() + "'";
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        cname.Text = dr["Name"].ToString();
                        cname.ReadOnly = true;
                        txt_mail.Text = dr["email"].ToString();
                        txt_mail.ReadOnly = true;
                    }                       
                }               
                Session["name"] = cname.Text.ToString();
            }            
        }
    }

 

This question does not have replies that have been liked.