Popup window using CSS/Javascript in ASP.NET
<ContentTemplate>
<asp:HyperLink ID="link" runat="server"></asp:HyperLink><asp:MultiView ID="MultiViewSearchState" runat="server" ActiveViewIndex="0"开发者_开发百科>
<asp:View ID="ViewCommands" runat="server"> <asp:Button ID="btn" runat="server" Text="Select" OnClick="btn_Click" /> <asp:Button ID="ButtonClear" runat="server" Text="Clear" OnClick="ButtonClear_Click" />
</asp:View>
<asp:View ID="ViewSearch" runat="server">
<asp:Button ID="ButtonCancel" runat="server" Text="Cancel" OnClick="ButtonCancel_Click" />
<dyncontrols:SearchControl runat="server" ID="searchControl"/>
</asp:View>
</asp:MultiView>
</ContentTemplate>
When pressing the button inside ViewCommands, the View is set to ViewSearch. However, this is done with inline html, and I'd like it to be a popup. What is the best way to achieve this using only css and/or javascript?
I've read this and this but it wasn't enough for me to understand how to do it in ASP.NET using Views. I have also seen ModalPopupExtenders being used, but those don't work on this page because of some UpdatePanel so I figured I'd do a css/js solution.
Well, here is an example of a popup in jQuery & CSS: http://www.kompeller.co.uk/6266540/
You'll need to set the CssClass on the elements that you want to style then simply set the styles as the links you provide suggest. Alternatively if you are using .NET 4 you can set the "ClientID". The CSS may be something like:
.button
{
position: absolute;
padding: 20px 40px;
background: #fff;
border: 2px solid #ccc;
}
精彩评论