Reputation: 6368
I have a button on my page. I have a panel on my page. I also have a multiline textbox on my page.
Now I want to make panel visible and invisible without disturbing the position of the textbox below. Just like notification panel on facebook.
Here is the code to make panel visible/invisible :
Protected Sub btnReauests_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnReauests.Click
If pnlShowRequests.Visible = True Then
pnlShowRequests.Visible = False
Else
pnlShowRequests.Visible = True
End If
End Sub
I have also tried setting the z-order style of the panel like this
<asp:Panel ID="pnlShowRequests" runat="server" style =" z-index : 1; position : relative; top: 0px; left: 255px; width: 206px; height: 200px;" Visible="False">
</asp:Panel>
Upvotes: 2
Views: 7998
Reputation: 1805
You would have to wrap the panel in it's own div and set the height. This way when you make it invisible, it wont affect the position of the elements around it.
For example:
<div style="height: 100px;">
<asp:panel></asp:panel>
</div>
<asp:textbox runat="server"></asp:textbox>
Upvotes: 5