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. Advertisements

  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. Advertisements

  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. Advertisements

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. dee
    Replies:
    7
    Views:
    591
  2. shruds
    Replies:
    1
    Views:
    1,273
    John C. Bollinger
    Jan 27, 2006
  3. Sam
    Replies:
    4
    Views:
    647
    The Directive
    Jan 13, 2004
  4. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    1,386
    Mark Rae
    Dec 21, 2006
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,853
    Smokey Grindel
    Dec 2, 2006
  6. Dan
    Replies:
    9
    Views:
    562
  7. Yash
    Replies:
    1
    Views:
    533
    bruce barker
    Dec 30, 2008
  8. BigDadyWeaver
    Replies:
    6
    Views:
    398
    BigDaddyWeaver
    Feb 3, 2004
Loading...