why does this tag always remain hidden?

B

Bob

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
 
T

Teemu Keiski

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
 
B

Bob

Thanks

Teemu Keiski said:
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">
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top