server control visible(false) after post back

Discussion in 'ASP .Net' started by walanta, Aug 28, 2006.

  1. walanta

    walanta Guest

    I'm trying to get rid of the TextBox1 and Button1 on the page after
    posted back. However, it's still visible. Any idea why?


    protected void Page_Load(object sender, EventArgs e)
    {
    if (Page.IsPostBack == true)
    {
    TextBox1.Visible.Equals(false);
    Button1.Visible.Equals(false);
    Label1.Text = "Page Posted back ";
    }
    }
    walanta, Aug 28, 2006
    #1
    1. Advertising

  2. Should be

    > TextBox1.Visible=false;
    > Button1.Visible=false;


    Equals is for comparing objects, not for setting values.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]

    <walanta> wrote in message
    news:...
    >
    >
    > I'm trying to get rid of the TextBox1 and Button1 on the page after
    > posted back. However, it's still visible. Any idea why?
    >
    >
    > protected void Page_Load(object sender, EventArgs e)
    > {
    > if (Page.IsPostBack == true)
    > {
    > TextBox1.Visible.Equals(false);
    > Button1.Visible.Equals(false);
    > Label1.Text = "Page Posted back ";
    > }
    > }
    Eliyahu Goldin, Aug 28, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alejandro Penate-Diaz

    if (control.visible == false) viewstate disabled?

    Alejandro Penate-Diaz, Mar 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,464
    Alejandro Penate-Diaz
    Mar 4, 2005
  2. Nick Stansbury
    Replies:
    6
    Views:
    464
    Nick Stansbury
    Apr 11, 2005
  3. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    757
    Masudur
    May 25, 2007
  4. psb
    Replies:
    0
    Views:
    159
  5. Andrea Williams

    User control not visible when setting .Visible = true;

    Andrea Williams, Jan 26, 2004, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    500
    Andrea Williams
    Jan 28, 2004
Loading...

Share This Page