- 浏览: 39171 次
- 性别:
- 来自: 北京
文章分类
最新评论
前台页面:
<div style="display:none">
<asp:NumberTextBox runat="server" ID="aaas"></asp:NumberTextBox></div>
<h2 class="mt10">促品/宣传物料信息</h2>
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table border="0" cellspacing="0" cellpadding="0" class="info_tab1 mt10" width="100%">
<tr>
<%--<th style="width:5%">序号</th>
<th width="12%">礼品名称</th>
<th width="10%">生产量</th>
<th width="10%">生产成本(元)</th>
<th width="10%">生产厂家</th>
<th width="10%">备注</th>
<th width="10%">使用方法</th>
<th width="10%">详细说明</th>
<th width="19%">物料图片</th>
<th >操作</th>--%>
<th >序号</th>
<th >礼品名称</th>
<th >生产量</th>
<th >生产成本(元)</th>
<th >生产厂家</th>
<th >备注</th>
<th >使用方法</th>
<th >详细说明</th>
<th >物料图片</th>
<th >操作</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr >
<td >
<%#Container.ItemIndex + 1%>
</td>
<td ><span class="redf">
<asp:HiddenField ID="materialResourceID" runat="server" Value='<%#DataBinder.eval_r(Container.DataItem, "resource_id")%>' />
<asp:TextBox ID="giftname" size="13" MaxLength="40" runat="server" Text='<%#DataBinder.eval_r(Container.DataItem, "present_name")%>'></asp:TextBox>
<span class="title_red">*</span>
</span>
</td>
<td >
<asp:NumberTextBox ID="producenum" size="13" MaxLength="10" runat="server" Model="Decimal" NumberOfDecimals="2" Text='<%#DataBinder.eval_r(Container.DataItem, "produce_count")%>'></asp:NumberTextBox>
</td>
<td ><span class="redf">
<asp:NumberTextBox ID="producecost" size="13" MaxLength="10" runat="server" Model="Decimal" NumberOfDecimals="2" Text='<%#DataBinder.eval_r(Container.DataItem, "produce_price")%>'></asp:NumberTextBox>
</span></td>
<td ><span class="redf">
<asp:TextBox ID="producecompany" size="13" MaxLength="40" runat="server" Text='<%#DataBinder.eval_r(Container.DataItem, "produce_vender")%>'></asp:TextBox>
</span></td>
<td ><span class="redf">
<asp:TextBox ID="giftremark" size="13" MaxLength="90" runat="server" Width="108px" Text='<%#DataBinder.eval_r(Container.DataItem, "remarks")%>'></asp:TextBox>
</span></td>
<td ><span class="redf">
<asp:TextBox ID="usemethod" size="13" MaxLength="90" runat="server" Width="117px" Text='<%#DataBinder.eval_r(Container.DataItem, "use_type")%>'></asp:TextBox>
</span></td>
<td >
<span class="redf">
<asp:TextBox ID="detailinfo" size="13" MaxLength="90" runat="server" Width="105px" Text='<%#DataBinder.eval_r(Container.DataItem, "instraction")%>'></asp:TextBox>
</span>
</td>
<td>
<asp:HiddenField ID="PicFilePathLink" runat="server" Value='<%#DataBinder.eval_r(Container.DataItem, "PicFilePathLink")%>' />
<asp:UpdatePanel ID="UpdatePanel4" runat="server" RenderMode="Block" UpdateMode="Conditional">
<Triggers>
<asp:PostBackTrigger ControlID="LinkButton3" />
</Triggers>
</asp:UpdatePanel>
<asp:HyperLink ID="HyperLink2" runat="server" Target="_blank" Visible='<%#DataBinder.eval_r(Container.DataItem, "urlLinkVisiblity")%>' Text='<%#DataBinder.eval_r(Container.DataItem, "pic_filepath")%>'></asp:HyperLink>
<asp:LinkButton Visible='<%#DataBinder.eval_r(Container.DataItem, "urlLinkVisiblity")%>' ID="LinkButton3" Text="[X]" runat="server" OnCommand="sell_delFile_Click" CommandName='<%#DataBinder.eval_r(Container.DataItem, "resource_id")%>'>
</asp:LinkButton>
<asp:HiddenField ID="HiddenField2" runat="server" />
<asp:UpdatePanel ID="UpdatePanel5" runat="server" Visible='<%#DataBinder.eval_r(Container.DataItem, "uploadVisiblity")%>' RenderMode="Block" UpdateMode="Conditional">
<ContentTemplate>
<asp:FileUpload ID="FileUpload2" runat="server" Width="250px" onchange="PreviewImg_sell(this);" /></ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LinkButton4" />
</Triggers>
</asp:UpdatePanel>
<asp:LinkButton ID="LinkButton4" runat="server" style="display:none" Text="aa" OnClick="sell_MaterialUpload_Click"></asp:LinkButton>
</td>
<td>
<asp:LinkButton runat="server" ID="deleteBtn" OnCommand="deleteBtn_Click" CommandName='<%#DataBinder.eval_r(Container.DataItem, "resource_id")%>' Text="删除"></asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<div class="alignr pad10">选择产品数:<asp:DropDownList runat="server" ID="addProduceNumber">
<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="2"></asp:ListItem>
<asp:ListItem Text="3" Value="3"></asp:ListItem>
<asp:ListItem Text="4" Value="4"></asp:ListItem>
<asp:ListItem Text="5" Value="5"></asp:ListItem>
<asp:ListItem Text="6" Value="6"></asp:ListItem>
<asp:ListItem Text="7" Value="7"></asp:ListItem>
<asp:ListItem Text="8" Value="8"></asp:ListItem>
<asp:ListItem Text="9" Value="9"></asp:ListItem>
<asp:ListItem Text="10" Value="10"></asp:ListItem>
</asp:DropDownList>
<asp:Button Text="增 加" runat="server" ID="addProduceBtn" OnClick="addMaterialBtn_Click" CssClass="btn_sorange" /></div>
<div class="alignc pb20 pt20">
<asp:Button ID="PromotionPlan" class="btn_sub" Text="提交" runat="server" OnClientClick='return check_input_null(CheckList);'
onclick="SavePromotionPlan_Click"></asp:button>
<asp:LinkButton runat="server" Text="保存草稿" ID="saveCBtn" OnClientClick='return check_input_null(CheckList);' OnClick="saveCBtn_Click" ></asp:LinkButton>
</div>
后台处理:
public DataTable GridViewDataTable
{
get { return ViewState["GridViewDataTable"] == null ? null : (DataTable)ViewState["GridViewDataTable"]; }
set { ViewState["GridViewDataTable"] = value; }
}
public void fileUpload_material()
{
FileUpload FileUpload2 = new FileUpload();
HiddenField HiddenField2 = new HiddenField();
LinkButton LinkButton3 = new LinkButton();
HyperLink HyperLink2 = new HyperLink();
HiddenField PicFilePathLink = new HiddenField();
foreach (RepeaterItem item in this.Repeater1.Items)
{
FileUpload2 = (FileUpload)item.FindControl("FileUpload2");
HiddenField2 = (HiddenField)item.FindControl("HiddenField2");
LinkButton3 = (LinkButton)item.FindControl("LinkButton3");
HyperLink2 = (HyperLink)item.FindControl("HyperLink2");
PicFilePathLink = (HiddenField)item.FindControl("PicFilePathLink");
if (FileUpload2.PostedFile != null && FileUpload2.PostedFile.ContentLength > 0)
{
string ext = System.IO.Path.GetExtension(FileUpload2.PostedFile.FileName).ToLower();
if (ext != ".jpg" && ext != ".jepg" && ext != ".bmp" && ext != ".gif" && ext != ".png")
{
this.Alert("请上传(*.jpg,*.jepg,*.bmp,*.gif,*.png)格式的图片!");
return;
}
string dir = Server.MapPath(PRODUCE_TEMP_FILE_PATH);
if (Directory.Exists(dir) == false)
{
Directory.CreateDirectory(dir);
}
string filename = DateTime.Now.ToString("yyyyMMddHHmmssffff") + ext;
string path = PRODUCE_TEMP_FILE_PATH + filename;
FileUpload2.PostedFile.SaveAs(Server.MapPath(path));
HiddenField2.Value = path;
FileUpload2.Visible = false;
LinkButton3.Visible = true;
HyperLink2.Visible = true;
HyperLink2.Text = FileUpload2.FileName;
HyperLink2.NavigateUrl = path;
PicFilePathLink.Value = path;
break;
}
else
{
//do some thing;
}
}
}
protected void sell_MaterialUpload_Click(object sender, EventArgs e)
{
//FileUpload fu = (FileUpload)((LinkButton)sender).Parent.FindControl("FileUpload2");
// string str = fu.PostedFile.FileName;
fileUpload_material();
}
protected void sell_delFile_Click(object sender, CommandEventArgs e)
{
string resourceid = e.CommandName;
DataTable dt = GridViewDataTable;
refresh_Repeater(dt);
foreach (DataRow dr in dt.Rows)
{
if (resourceid.Equals(dr["resource_id"]))
{
string path = dr["PicFilePathLink"].ToString();
path = Server.MapPath(path);
FileInfo file = new FileInfo(path);
if (file.Exists)
{
file.Delete();
}
dr["pic_filepath"] = "";
//dr["PicFilePathLink"] = "";
dr["urlLinkVisiblity"] = false;
dr["uploadVisiblity"] = true;
break;
}
}
Repeater1.DataSource = dt;
Repeater1.DataBind();
}
//---------------------------------------------------------------------------------------
private DataTable getInitDataTable(DataTable dt)
{
if (dt == null)
{
dt = new DataTable();
DataColumn dc;
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "resource_id";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "present_name";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "produce_count";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "produce_price";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "produce_vender";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "remarks";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "use_type";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "instraction";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "pic_filepath";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Boolean");
dc.ColumnName = "uploadVisiblity";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.Boolean");
dc.ColumnName = "urlLinkVisiblity";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
dc = new DataColumn();
dc.DataType = System.Type.GetType("System.String");
dc.ColumnName = "PicFilePathLink";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add(dc);
}
return dt;
}
protected void addMaterialBtn_Click(object sender, EventArgs e)
{
DataTable dt = GridViewDataTable;
dt = getInitDataTable(dt);
refresh_Repeater(dt);
for (int i = 0; i < Convert.ToInt16(addProduceNumber.SelectedValue); i++)
{
DataRow dr = dt.NewRow();
dr["resource_id"] = System.Guid.NewGuid().ToString();
dr["present_name"] = "";
dr["produce_count"] = "0";
dr["produce_price"] = "0";
dr["produce_vender"] = "";
dr["remarks"] = "";
dr["use_type"] = "";
dr["pic_filepath"] = "";
dr["instraction"] = "";
dr["uploadVisiblity"] = true;
dr["PicFilePathLink"] = "";
dr["urlLinkVisiblity"] = false;
dt.Rows.Add(dr);
}
GridViewDataTable = dt;
Repeater1.DataSource = GridViewDataTable;
Repeater1.DataBind();
}
private void refresh_Repeater(DataTable dt)
{
foreach (RepeaterItem item in this.Repeater1.Items)
{
TextBox tN = (TextBox)item.FindControl("giftname");
if (tN != null)
{
dt.Rows[item.ItemIndex]["present_name"] = tN.Text;
}
NumberTextBox pN = (NumberTextBox)item.FindControl("producenum");
if (pN != null)
{
dt.Rows[item.ItemIndex]["produce_count"] =pN.Text;
}
NumberTextBox std = (NumberTextBox)item.FindControl("producecost");
if (std != null)
{
dt.Rows[item.ItemIndex]["produce_price"] = std.Text;
}
TextBox mq = (TextBox)item.FindControl("producecompany");
if (mq != null)
{
dt.Rows[item.ItemIndex]["produce_vender"] = mq.Text;
}
TextBox co = (TextBox)item.FindControl("giftremark");
if (co != null)
{
dt.Rows[item.ItemIndex]["remarks"] = co.Text;
}
TextBox rp = (TextBox)item.FindControl("usemethod");
if (rp != null)
{
dt.Rows[item.ItemIndex]["use_type"] = rp.Text;
}
TextBox wp = (TextBox)item.FindControl("detailinfo");
if (wp != null)
{
dt.Rows[item.ItemIndex]["instraction"] = wp.Text;
}
HiddenField hf = (HiddenField)item.FindControl("materialResourceID");
if (hf != null)
{
dt.Rows[item.ItemIndex]["resource_id"] = hf.Value;
}
HiddenField picl = (HiddenField)item.FindControl("PicFilePathLink");
if (picl != null)
{
dt.Rows[item.ItemIndex]["PicFilePathLink"] = picl.Value;
}
dt.Rows[item.ItemIndex]["uploadVisiblity"] = true;
HyperLink HL2 = (HyperLink)item.FindControl("HyperLink2");
if(HL2!=null){
dt.Rows[item.ItemIndex]["pic_filepath"] = HL2.Text;
if (!string.IsNullOrEmpty(HL2.Text))
{
dt.Rows[item.ItemIndex]["uploadVisiblity"] = false;
dt.Rows[item.ItemIndex]["urlLinkVisiblity"] = true;
}
else
{
dt.Rows[item.ItemIndex]["uploadVisiblity"] = true;
dt.Rows[item.ItemIndex]["urlLinkVisiblity"] = false;
}
}
}
}
protected void deleteBtn_Click(object sender, CommandEventArgs e)
{
string resourceid = e.CommandName;
DataTable dt = GridViewDataTable;
refresh_Repeater(dt);
foreach (DataRow dr in dt.Rows)
{
if (resourceid.Equals(dr["resource_id"]))
{
dr.Delete();
break;
}
}
GridViewDataTable = dt;
Repeater1.DataSource = GridViewDataTable;
Repeater1.DataBind();
}
protected List<ProductSellMaterialEntity> getProduceMaterialList(string productSellPlanID)
{
List<ProductSellMaterialEntity> list = new List<ProductSellMaterialEntity>();
foreach (RepeaterItem item in this.Repeater1.Items)
{
ProductSellMaterialEntity psm = new ProductSellMaterialEntity();
TextBox tN = (TextBox)item.FindControl("giftname");
if (tN != null)
{
psm.PresentName = tN.Text;
if (string.IsNullOrEmpty(psm.PresentName))
{
return null;
}
}
NumberTextBox pN = (NumberTextBox)item.FindControl("producenum");
if (pN != null)
{
psm.ProduceCount =Convert.ToDecimal(pN.Text);
}
NumberTextBox std = (NumberTextBox)item.FindControl("producecost");
if (std != null)
{
psm.ProducePrice = Convert.ToDecimal(std.Text);
}
TextBox mq = (TextBox)item.FindControl("producecompany");
if (mq != null)
{
psm.ProduceVender= mq.Text;
}
TextBox co = (TextBox)item.FindControl("giftremark");
if (co != null)
{
psm.Remarks = co.Text;
}
TextBox rp = (TextBox)item.FindControl("usemethod");
if (rp != null)
{
if (!string.IsNullOrEmpty(rp.Text))
{
psm.UseType = rp.Text;
}
}
TextBox wp = (TextBox)item.FindControl("detailinfo");
if (wp != null)
{
if (!string.IsNullOrEmpty(wp.Text))
{
psm.Instraction = wp.Text;
}
}
HiddenField hf = (HiddenField)item.FindControl("materialResourceID");
if (hf != null)
{
psm.ResourceId = hf.Value;
}
HiddenField pf = (HiddenField)item.FindControl("PicFilePathLink");
if (pf != null)
{
if (!string.IsNullOrEmpty(pf.Value))
{
string path = Server.MapPath(pf.Value);
string filetype = pf.Value.Substring(pf.Value.LastIndexOf("."));
FileInfo file = new FileInfo(path);
if (file.Exists)
{
string dir = Server.MapPath(PRODUCE_FILE_PATH);
if (Directory.Exists(dir) == false)
{
Directory.CreateDirectory(dir);
}
string fname = System.Guid.NewGuid().ToString() + filetype;
string targetFile = dir + fname;
if (path.IndexOf("ImportFiles") >= 0)
{
file.CopyTo(targetFile);
}
psm.PicFilepath = PRODUCE_FILE_PATH + fname;
}
if (path.IndexOf("ImportFiles") >= 0)
{
FileInfo filetemp = new FileInfo(path);
filetemp.Delete();
}
}
}
psm.SellPlanId =productSellPlanID;
list.Add(psm);
}
return list;
}
foreach (ProductSellMaterialEntity psm in list2)
{
psm.SaveNew(broker);
}
相关推荐
CKEditor可以替换普通的文本框,因此你需要在***页面中添加一个<asp:TextBox>控件,并设置TextMode属性为"MultiLine",以启用多行文本输入。 4. 配置CKEditor 通过JavaScript调用CKEDITOR.replace方法,将标准的...
这可以通过`UpdatePanel`控件或者`AjaxControlToolkit`中的组件实现,比如`AsyncFileUpload`用于异步文件上传。 4. **数据绑定**:当内容需要存储和检索时,数据绑定是关键。ASP.NET支持多种数据绑定方式,如`...
比较,FTP编辑,FTP上传下载,加密,十六进制编辑,列模式,回行显示,正则表达式,多行查找和替换,代码折叠,关键字高亮显示,编辑400GB的大文件,比较100GB的大文件,对超过1G的大文件排序,删除重复,执行自定义...
2.增加导入考生文件是否上传完成判断 3.增加导入文件格式检测提示 4.增加导入试题确认提示 5.考生管理增加刷新按钮 修改 1.去除了导入试题字符数量的限制 2.修改安装文件,加入了一些提示 修正 1.修正考生管理无法...
“文件->远程操作->FTP 上传”在“设置”选项卡中设置好参数(“子目录”前面应该加“/”如“/web/”),点击“确定”回到“FTP 上传”选项卡,然后点击“上传”即可;“批量上传”的设置类似。 【12】软件技巧——...
改善: 上传文件时显示上传中提示。 改善: JSON解析失败时,通过弹出层显示服务器返回的HTML页面。 改善: [IE] 弹出框支持阴影效果。 Bugfix: 浏览器使用有些插件时,上传文件提示不正确。 Bugfix: 单独调用图片...
“文件->远程操作->FTP 上传”在“设置”选项卡中设置好参数(“子目录”前面应该加“/”如“/web/”),点击“确定”回到“FTP 上传”选项卡,然后点击“上传”即可;“批量上传”的设置类似。 【12】软件技巧——...
对于.NET开发者,可以通过NuGet包管理器或者手动下载CKEditor的DLL文件,然后在ASP.NET页面中引入控件。在Java环境中,可以通过Maven或Gradle导入依赖,然后在JSP或Spring MVC等框架中使用。 4. **使用步骤** - ...
asp.net行业电子商务网站系统蓝色版下载,B2B电子商务平台、电子商务网站管理系统,专为各行业门户贸易网站设计的,ASP.NET编程的行业B2B电子商务系统全功能,利用B2B仿阿里巴巴电子商务网上贸易网站管理系统,可在全球...
3. 图片和文件管理:内置文件上传功能,用户可以直接上传图片和其他文件,并在编辑器中插入。 4. 超链接:轻松添加、编辑和删除超链接。 5. HTML标签支持:允许用户直接输入HTML代码,增强编辑灵活性。 五、...
下载的压缩包包含了针对不同后端语言(如 Asp、asp.net、jsp、php)的示例,以及一个 examples 目录,包含了 HTML 示例。核心文件包括 kindeditor.js 和 kindeditor-min.js,其中 kindeditor-min.js 是压缩后的版本...
- 使用不同语言(如ASP、ASP.NET、Java)结合数据库实现树形结构数据的展示。 7. 无边框效果: - CSS技巧,隐藏元素边框以达到无边框效果。 8. 连动下拉框技术: - 当一个下拉框的选项变化时,影响另一个下拉框...
“文件->远程操作->FTP 上传”在“设置”选项卡中设置好参数(“子目录”前面应该加“/”如“/web/”),点击“确定”回到“FTP 上传”选项卡,然后点击“上传”即可;“批量上传”的设置类似。 【12】软件技巧——...
8. ASP.NET上传控件:FileUpload控件允许用户在网页上选择文件进行上传。 9. 遍历集合:在Java等语言中,使用Iterator遍历集合,需要先用hasNext()判断是否还有元素,然后用next()获取下一个元素。 10. Textarea...
综上所述,以上内容覆盖了文本框滚动条设置、线程生命周期、宏与模块的区别、分布式数据库的特点、HTML元素类型、排序算法分类、HTML标题级别、Java数组声明、Visual FoxPro配置文件、ASP.NET支持的语言、FTP协议、...