1.前端引用
<%@ Page ValidateRequest="false" Language="C#" AutoEventWireup="true" CodeBehind="ProductsAdd.aspx.cs" Inherits="Maticsoft.Web.Manager.ProductsAdd" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="utf8-net/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="utf8-net/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="utf8-net/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
var ue = UE.getEditor('txtEditorContents');
</script>
<script type="text/javascript">
function previewFile() {
var preview = document.querySelector('img');
var file = document.querySelector('input[type=file]').files[0];
var reader = new FileReader();
reader.onloadend = function () {
preview.src = reader.result;
}
if (file) {
reader.readAsDataURL(file);
} else {
preview.src = "";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="place">
<span>位置:</span>
<ul class="placeul">
<li><a href="#">首页</a></li>
<li><a href="#">表单</a></li>
</ul>
</div>
<div class="formbody">
<div class="formtitle"><span>基本信息</span></div>
<ul class="forminfo">
<li>
<label>商品名</label><input name="txt_name" type="text" class="dfinput" runat="server" id="txt_name" />
</li>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="商品名不能为空!" ControlToValidate="txt_name" ForeColor="Red"></asp:RequiredFieldValidator>
<li>
<label>商品分类</label>
<asp:DropDownList ID="DropDownList2" runat="server" Height="29px" Width="193px">
</asp:DropDownList>
</li>
<li>
<label>商品单价</label><input name="txt_name" type="text" class="dfinput" runat="server" id="Text2" />
</li>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="价格不能为空!" ControlToValidate="Text2" ForeColor="Red"></asp:RequiredFieldValidator>
<li>
<label>批发价</label><input name="txt_name" type="text" class="dfinput" runat="server" id="Text3" />
</li>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="价格不能为空!" ControlToValidate="Text3" ForeColor="Red"></asp:RequiredFieldValidator>
<li>
<label>单位</label><input name="txt_name" type="text" class="dfinput" runat="server" id="Text1" />
</li>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="单位不能为空!" ControlToValidate="Text1" ForeColor="Red"></asp:RequiredFieldValidator>
<%-- <li>
<label>商品介绍</label><textarea name="txta" style="width: 499px; height: 41px" id="Textarea4" runat="server"></textarea>
</li>--%>
<%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="商品介绍不能为空!" ControlToValidate="Textarea4"></asp:RequiredFieldValidator>--%>
<li>
<label>商品图片</label><asp:FileUpload ID="FileUpload" runat="server" onchange="previewFile()" />
<asp:Image ID="preview" runat="server" Height="42px" Width="46px" />
</li>
<li>
<label>备注</label><textarea name="txta1" style="width: 479px; height: 41px" id="Textarea1" runat="server"></textarea>
</li>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="备注不能为空!" ControlToValidate="Textarea1" ForeColor="Red"></asp:RequiredFieldValidator>
<li>
<label>销量</label>
<asp:TextBox ID="TextBox1" runat="server" CssClass="dfinput"></asp:TextBox>
</li>
<li>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="销量不能为空!" ControlToValidate="TextBox1" ForeColor="Red"></asp:RequiredFieldValidator>
</li>
<li>
<label>是否热门</label>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="1">热销</asp:ListItem>
<asp:ListItem Value="0">不热销</asp:ListItem>
</asp:DropDownList>
</li>
<li>
<label>推荐</label>
<asp:DropDownList ID="DropDownList3" runat="server">
<asp:ListItem Value="1">推荐</asp:ListItem>
<asp:ListItem Value="0">不推荐</asp:ListItem>
</asp:DropDownList>
</li>
<li>
<label>新品</label>
<asp:DropDownList ID="DropDownList4" runat="server">
<asp:ListItem Value="1">新品</asp:ListItem>
<asp:ListItem Value="0">不是新品</asp:ListItem>
</asp:DropDownList>
</li>
<li>
<label>优惠</label>
<asp:DropDownList ID="DropDownList5" runat="server">
<asp:ListItem Value="1">优惠</asp:ListItem>
<asp:ListItem Value="0">不优惠</asp:ListItem>
</asp:DropDownList>
</li>
<li>
<label>轮播图</label>
<asp:DropDownList ID="DropDownList6" runat="server">
<asp:ListItem Value="1">宣传</asp:ListItem>
<asp:ListItem Value="0">不宣传</asp:ListItem>
</asp:DropDownList>
</li>
<li>
<label>是否下架</label>
<asp:DropDownList ID="DropDownList7" runat="server">
<asp:ListItem Value="0">否</asp:ListItem>
<asp:ListItem Value="1">是</asp:ListItem>
</asp:DropDownList>
</li>
<li>
<label>颜色</label>
<asp:TextBox ID="TextBox2" runat="server" CssClass="dfinput" placeholder="颜色要以逗号分隔开比如:黄,红" Height="28px" Width="378px"></asp:TextBox>
</li>
<li>
<asp:TextBox ID="txtEditorContents" name="txtEditorContents" runat="server" TextMode="MultiLine" Height="200px" Width="1000px" ClientIDMode="Static "> </asp:TextBox><asp:Button ID="btn_add" runat="server" Text="确认添加" CssClass="btn" OnClick="btn_add_Click" Height="39px" Width="121px" OnClientClick="getcked()" />
</li>
</ul>
</div>
</form>
</body>
</html>
2.后台赋值
model.P_text = txtEditorContents.Text;
下载地址:链接:https://pan.baidu.com/s/1pJmEsR2LUJCljkNBuqabpA 密码:0r18
成为不了聪明的人,那就做一个有耐心、肯钻研,坚持不懈,永不放弃的人……