why does this tag always remain hidden?

Discussion in 'ASP .Net' started by Bob, Jun 14, 2006.

  1. Bob

    Bob Guest

    Hi,

    I'm not sure of the priority in execution between aspx and aspx.vb code.
    I define a tag which must be invisible as long as the user has not clicked
    in the dropdownlist.
    The problem is that it never becomes visible. When an user clicks in the
    dropdownlist, the page is postbacked, so it would be visible, no?
    Thanks for help
    Bob

    The aspx file:
    <a href="#titel" id="ti" runat="server" style="visibilty:hidden"> Back</a>

    <asp:DropDownList ID="DropDownList1" runat="server" >
    </asp:DropDownList>

    The code-behind:
    Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    Handles Me.Load
    ....
    if IsPostBack then
    ti.visible=True
    end if
    ....

    end sub

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object,
    ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
    ....

    end sub
     
    Bob, Jun 14, 2006
    #1
    1. Advertising

  2. Bob

    Teemu Keiski Guest

    Hi,

    setting Vsiible="True" in code doesn't affect the style="..." you have on
    the element.

    <a href="#titel" id="ti" runat="server" style="visibility:hidden"> Back</a>

    About server-side Visible property
    ========================
    Visible = False -- means that control's HTML is not sent to the browser at
    all
    Visible=True -- means that control's HTML is sent to the browser

    But when it is Visible="true" your style which hides it at client, is taking
    action.

    Therefore change the ti element to be like:

    <a href="#titel" id="ti" runat="server" Visible="False"> Back</a>

    and removing the style should work

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke



    "Bob" <> wrote in message
    news:...
    > Hi,
    >
    > I'm not sure of the priority in execution between aspx and aspx.vb code.
    > I define a tag which must be invisible as long as the user has not clicked
    > in the dropdownlist.
    > The problem is that it never becomes visible. When an user clicks in the
    > dropdownlist, the page is postbacked, so it would be visible, no?
    > Thanks for help
    > Bob
    >
    > The aspx file:
    > <a href="#titel" id="ti" runat="server" style="visibilty:hidden">
    > Back</a>
    >
    > <asp:DropDownList ID="DropDownList1" runat="server" >
    > </asp:DropDownList>
    >
    > The code-behind:
    > Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    > Handles Me.Load
    > ...
    > if IsPostBack then
    > ti.visible=True
    > end if
    > ...
    >
    > end sub
    >
    > Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object,
    > ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
    > ...
    >
    > end sub
    >
    >
     
    Teemu Keiski, Jun 14, 2006
    #2
    1. Advertising

  3. Bob

    Bob Guest

    Thanks

    "Teemu Keiski" <> wrote in message
    news:O6LF3A$...
    > Hi,
    >
    > setting Vsiible="True" in code doesn't affect the style="..." you have on
    > the element.
    >
    > <a href="#titel" id="ti" runat="server" style="visibility:hidden">

    Back</a>
    >
    > About server-side Visible property
    > ========================
    > Visible = False -- means that control's HTML is not sent to the browser at
    > all
    > Visible=True -- means that control's HTML is sent to the browser
    >
    > But when it is Visible="true" your style which hides it at client, is

    taking
    > action.
    >
    > Therefore change the ti element to be like:
    >
    > <a href="#titel" id="ti" runat="server" Visible="False"> Back</a>
    >
    > and removing the style should work
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > http://blogs.aspadvice.com/joteke
    >
    >
    >
    > "Bob" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > I'm not sure of the priority in execution between aspx and aspx.vb code.
    > > I define a tag which must be invisible as long as the user has not

    clicked
    > > in the dropdownlist.
    > > The problem is that it never becomes visible. When an user clicks in the
    > > dropdownlist, the page is postbacked, so it would be visible, no?
    > > Thanks for help
    > > Bob
    > >
    > > The aspx file:
    > > <a href="#titel" id="ti" runat="server" style="visibilty:hidden">
    > > Back</a>
    > >
    > > <asp:DropDownList ID="DropDownList1" runat="server" >
    > > </asp:DropDownList>
    > >
    > > The code-behind:
    > > Private Sub Page_Load(ByVal sender As Object, ByVal e As

    System.EventArgs)
    > > Handles Me.Load
    > > ...
    > > if IsPostBack then
    > > ti.visible=True
    > > end if
    > > ...
    > >
    > > end sub
    > >
    > > Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object,
    > > ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
    > > ...
    > >
    > > end sub
    > >
    > >

    >
    >
     
    Bob, Jun 15, 2006
    #3
    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. shruds
    Replies:
    1
    Views:
    836
    John C. Bollinger
    Jan 27, 2006
  2. Sam
    Replies:
    4
    Views:
    476
    The Directive
    Jan 13, 2004
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,003
    Smokey Grindel
    Dec 2, 2006
  4. Dan
    Replies:
    9
    Views:
    434
  5. Yash
    Replies:
    1
    Views:
    437
    bruce barker
    Dec 30, 2008
Loading...

Share This Page