.net弹出框预览图片功能实现
我们使用DEV工具
首先在该页面xxx.aspx页面里面注册DEV,写在页面最开始
<%@ Register assembly="DevExpress.Web.v16.2, Version=16.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web" tagprefix="dx" %>
然后粘贴如下代码,弹出框+显示图片功能前端代码:
<dx:ASPxPopupControl ID="popupChangeRuleImg" runat="server" AllowDragging="True" AllowResize="True" ClientInstanceName="popupChangeRule" CloseAction="CloseButton" CssClass="auto-style3" HeaderText="选择加分项" Height="384px" Modal="True" PopupAnimationType="Fade" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" ShowCloseButton="False" ShowFooter="True" ShowPageScrollbarWhenModal="True" Theme="Aqua" Width="537px">
<HeaderImage Url="~/images/edit.png">
</HeaderImage>
<FooterStyle>
<Paddings Padding="5px" />
</FooterStyle>
<FooterTemplate>
<dx:ASPxMenu ID="mnuToolBar" runat="server" EnableTheming="True" ShowAsToolbar="True" Theme="Aqua">
<ClientSideEvents ItemClick="function(s, e) {
e.processOnServer = false;
var itemName = e.item.name;
switch(itemName){
case 'Cancel':
popupChangeRule.Hide();
break;
}
}" />
<Items>
<dx:MenuItem Name="Cancel" Text="取消">
<Image Url="~/images/close.gif">
</Image>
</dx:MenuItem>
</Items>
</dx:ASPxMenu>
</FooterTemplate>
<contentcollection>
<dx:PopupControlContentControl ID="PopupControlContentControl3" runat="server" SupportsDisabledAttribute="True">
<asp:Image ID="Image1" runat="server" Height="461px" Width="520px" />
</dx:PopupControlContentControl>
</contentcollection>
</dx:ASPxPopupControl>
最后在点击事件里面添加如下代码,也就是xxx.aspx.cs文件里面:
Image1.ImageUrl = "../files/0.jpg";
popupChangeRuleImg.ShowOnPageLoad=true;
我想给她买兰博基尼