⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productattributecontrol.ascx

📁 C#语言制作asp.net网上商店的
💻 ASCX
字号:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ProductAttributeControl.ascx.vb"
    Inherits="Admin_Product_Controls_ProductAttributeControl" %>
<%@ Register Src="ProductNavControl.ascx" TagName="ProductNavControl" TagPrefix="uc1" %>
<%@ Register Src="../../Controls/CheckAllCheckBoxControl.ascx" TagName="CheckAllCheckBoxControl"
    TagPrefix="uc1" %>

<script language="javascript" type="text/javascript" for="window" event="onclick">
<!--
return window_onclick()
// -->
</script>

<uc1:ProductNavControl ID="ProductNavControl1" runat="server" />

<script language="javascript" type="text/javascript">
function selectionChanged() {

	var type =document.getElementById('<%=ddlAttNewSelectionType.ClientID %>').value;
	var el = document.getElementById('trSection');
	if ( type == "2") {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}



function window_onload() {
selectionChanged()
}


</script>

<div class="blankbox">
</div>
<div class="dialog-title">
    <asp:Label ID="lblDialogTitle" runat="server" Text="商品选项管理"></asp:Label></div>
<div class="dialog-box">
    <div class="grid">
        <asp:GridView ID="gvAttributes" runat="server" AutoGenerateColumns="False" Width="100%"
            EmptyDataText="没有商品选项列表">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:CheckBox ID="cbSelect" runat="server" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                    <HeaderStyle Width="25px" HorizontalAlign="Center" />
                    <HeaderTemplate>
                        <uc1:CheckAllCheckBoxControl ID="CheckAllCheckBoxControl1" runat="server" Prefix="gvAttributes" />
                    </HeaderTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="选项名称">
                    <ItemTemplate>
                        <asp:Button ID="btnEdit" runat="server" CommandName="edit" Width="60px" Text="编辑" />&nbsp;
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField HeaderText="选项值" DataField="SelectionList" />
                <asp:TemplateField HeaderText="选项类型">
                    <ItemStyle Width="55px" />
                    <HeaderStyle Width="55px" />
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%#Resources.Enum.ProductAttributeType.Split(",")(Cint(eval("SelectionType"))) %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="排序">
                    <ItemTemplate>
                        <asp:TextBox ID="txtItemOrder" runat="server" Width="50px" Text='<%# Bind("ItemOrder") %>'></asp:TextBox>
                    </ItemTemplate>
                    <ItemStyle Width="50px" />
                    <HeaderStyle Width="50px" />
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <div class="blankbox">
    </div>
    <div>
        <asp:Button ID="btnDeleteAttribute" runat="server" Text="删除选中" OnClientClick="javascript:return toDel('gvAttributes')"
            Width="98px" />
        <asp:Button ID="btnUpdateSort" runat="server" Text="更新排序" Width="98px" />
    </div>
    <div class="blankbox">
    </div>
    <div id="title">
        <asp:Label ID="lbAddOrEdit" runat="server" Text="添加/编辑商品选项"></asp:Label></div>
        <div class ="hr"></div>
    <div class="row">
        <asp:Label ID="Label3" runat="server" Text="从选项模板中载入列表:"></asp:Label><asp:DropDownList
            ID="ddlAttTemplates" runat="server" Width="177px">
        </asp:DropDownList>
        <asp:Button ID="btnSetTemplate" runat="server" Text="载入" Width="88px" />&nbsp;
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Admin/Management/AttributeTemplate.aspx">管理商品选项模版</asp:HyperLink>
    </div>
    <fieldset>
        <p>
            <asp:Label ID="Label4" runat="server" Text="选项名称:" AssociatedControlID="txtAttributeNew"></asp:Label>
            <asp:TextBox ID="txtAttributeNew" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtAttributeNew"
                ErrorMessage="请输入选项名称" ValidationGroup="AddNewAttribute">*</asp:RequiredFieldValidator>
            <asp:Button ID="btnSaveAttTemplate" runat="server" Text="存储为选项模板" /><asp:Label ID="lblTemplateSaved"
                runat="server" Text=""></asp:Label></p>
        <p>
            <asp:Label ID="Label5" runat="server" Text="选项类型: " AssociatedControlID="ddlAttNewSelectionType"></asp:Label>
            <asp:DropDownList ID="ddlAttNewSelectionType" runat="server" onchange="selectionChanged()">
                <asp:ListItem Value="0">单项选择输入</asp:ListItem>
                <asp:ListItem Value="1">多项选择输入</asp:ListItem>
                <asp:ListItem Value="2">用户自行输入</asp:ListItem>
            </asp:DropDownList></p>
        <p>
            <asp:Label ID="Label6" runat="server" Text="选项说明:" AssociatedControlID="txtAttNewDesc"></asp:Label>
            <asp:TextBox ID="txtAttNewDesc" runat="server" Height="46px" TextMode="MultiLine"></asp:TextBox></p>
        <div id="trSection">
        
                <asp:Label ID="Label7" runat="server" Text="选项值:" AssociatedControlID="txtSelectionAdd"></asp:Label>
            <div style="float: left; border-right: #ffcc33 1px dashed; border-top: #ffcc33 1px dashed;
                border-left: #ffcc33 1px dashed; border-bottom: #ffcc33 1px dashed; padding: 5px;">
                <asp:GridView ID="gvSections" runat="server" AutoGenerateColumns="False" EmptyDataText="没有选项值列表"
                    Width="379px">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:CheckBox ID="cbSelect" runat="server" />
                            </ItemTemplate>
                            <HeaderTemplate>
                                <uc1:CheckAllCheckBoxControl ID="CheckAllCheckBoxControl1" runat="server" Prefix="gvSections" />
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="25px" />
                            <HeaderStyle Width="25px" HorizontalAlign="Center" />
                            <ControlStyle Width="25px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="选项值名称">
                            <ItemTemplate>
                                <asp:TextBox ID="txtSelection" runat="server" Width="150px" Text='<%# Bind("Value") %>'></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtSelection"
                                    Display="Dynamic" ErrorMessage="请输入选项值名称" ValidationGroup="haha">*</asp:RequiredFieldValidator>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="调整价格">
                            <ItemTemplate>
                                <asp:TextBox ID="txtPriceAdjustment" runat="server" Width="50px" Text='<%# Bind("priceAdjustment") %>'></asp:TextBox>
                                <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtPriceAdjustment"
                                    Display="Dynamic" ErrorMessage="请输入有效的调整价格" MaximumValue="9999999999" MinimumValue="-99999999"
                                    SetFocusOnError="True" Type="Currency" ValidationGroup="haha">*</asp:RangeValidator>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="排序">
                            <ItemTemplate>
                                <asp:TextBox ID="txtItemOrder" runat="server" Width="50px" Text='<%# Bind("ItemOrder") %>'></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtItemOrder"
                                    ErrorMessage="请输入排列顺序" ValidationGroup="haha">*</asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtItemOrder"
                                    ErrorMessage="请输入正确排列顺序" ValidationExpression="^\d+$" ValidationGroup="haha">*</asp:RegularExpressionValidator>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <p>
                    <asp:Label ID="Label8" runat="server" AssociatedControlID="txtSelectionAdd" Text="选项值名称:"></asp:Label><asp:TextBox
                        ID="txtSelectionAdd" runat="server">  </asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtSelectionAdd"
                        Text="*" ErrorMessage="请输入选项值名称" ValidationGroup="AddNewSection"></asp:RequiredFieldValidator></p>
                <p>
                    <asp:Label ID="Label9" runat="server" AssociatedControlID="txtPriceAdjustment" Text="调整价格:"></asp:Label><asp:TextBox
                        ID="txtPriceAdjustment" runat="server">0</asp:TextBox>
                    <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtPriceAdjustment"
                        Text="*" ErrorMessage="无效的价格" MaximumValue="9999999999" MinimumValue="-99999999"
                        SetFocusOnError="True" Type="Currency" ValidationGroup="AddNewSection"></asp:RangeValidator></p>
                <div>
                    <asp:Button ID="btnAddSection" runat="server" Text="添加新的选项值" ValidationGroup="AddNewSection"
                        Width="98px" />
                    <asp:Button ID="btnUpdateSection" runat="server" Text="更新" Width="98px" Visible="False"
                        ValidationGroup="haha" />
                    <asp:Button ID="btnDeleteSection" runat="server" Text="删除选中" Width="98px" OnClientClick="javascript:return toDel('gvSections')"
                        Visible="False" /></div>
            </div>
        </div>
    </fieldset>
    <div style="margin-left: 150px">
        <asp:Button ID="btnAddAttribute" runat="server" Text="添加新的选项" ValidationGroup="AddNewAttribute"
            Width="135px" />
        <asp:Button ID="btnClose" runat="server" Text="关闭编辑" Width="135px" Visible="False" />
    </div>
</div>
<asp:ValidationSummary ID="ValidationSummary2" runat="server" ValidationGroup="AddNewAttribute"
    DisplayMode="List" ShowMessageBox="True" ShowSummary="False" />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="AddNewSection"
    DisplayMode="List" ShowMessageBox="True" ShowSummary="False" />
<asp:ValidationSummary ID="ValidationSummary3" runat="server" ValidationGroup="haha"
    DisplayMode="List" ShowMessageBox="True" ShowSummary="False" />
<asp:HiddenField ID="hfProductID" runat="server" Value="1" />
<asp:HiddenField ID="hfEditIndex" runat="server" Value="-1" />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -