문제

I want to display user control when button_click event.

The user contol declartion is

<div id="divloginUControl" runat="server">
   <td></td>
      <td>
        <LUC:LoginLoader ID="loginUserControl" runat="server" />
      </td>
 </div>

I have tried with

protected void Page_Load(object sender, EventArgs e)
    {

        loginUserControl.Visible = false;
    }

 protected void Button1_Click(object sender, EventArgs e)
    {
        loginUserControl.Visible = true;

        System.Threading.Thread.Sleep(5000);
        ScriptManager1.RegisterPostBackControl(Button1);
        string result = asset.UserLogin(txtloginid.Text, txtpassword.Text);
        if (Convert.ToInt32(result) == 1)
        {
            Session["uname"] = txtloginid.Text;
            Server.Transfer("CreatedInventory.aspx");
        }
        else
        {
            pwdinfo.Text = "Please enter correct password";
            txtpassword.Focus();
        }
    }

but it is not working, please give some suggetions

도움이 되었습니까?

해결책

oh got it try this

protected void Page_Load(object sender, EventArgs e)
{
    if(!Page.IsPostback)
    {
        loginUserControl.Visible = false;
    }
}

Update : you are using multithreading right, i guess that its getting visible false in some other thread, check that

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top