中文字幕免费精品_亚洲视频自拍_亚洲综合国产激情另类一区_色综合咪咪久久

基于ASP.NET+EasyUI框架實現圖片上傳提交表單功能(js提交圖片)
來源:易賢網 閱讀:1767 次 日期:2016-08-05 16:14:31
溫馨提示:易賢網小編為您整理了“基于ASP.NET+EasyUI框架實現圖片上傳提交表單功能(js提交圖片)”,方便廣大網友查閱!

這篇文章主要介紹了基于ASP.NET+EasyUI框架實現圖片上傳再提交表單(js提交圖片)的相關資料,需要的朋友可以參考下

我的風格,先給大家展示下效果圖,具體效果圖如下所示,如果大家感覺還不錯很滿意請參考實現代碼。

名單

HTML的代碼:

<form id="ff" runat="server" method="post"> 

<div id="content" style="margin-left:50px;"> 

<table style="width:300px;" id="uniform"> 

<tr> 

<td>書畫名稱:<input id="paintingName" class="easyui-validatebox" validType:'paintingName' type="text" name="paintingName" data-options="required:true"/></td> 

</tr> 

<tr> 

<td>書畫類別:<input id="radPaint" value="國畫" class="easyui-validatebox" name="type" type="radio" checked="checked" data-options="required:true" />國畫 

<input id="rad" name="type" class="easyui-validatebox" type="radio" data-options="required:true" />書法</td> 

</tr> 

<tr> 

<td>書畫作者:<asp:DropDownList ID="ddlist" runat="server" Width="155px"></asp:DropDownList> 

</td> 

</tr> 

<tr> 

<td>書畫價格:<input id="price" class="easyui-numberbox" type="text" name="price" data-options="required:true"/>元</td> 

</tr> 

<tr> 

<td>高  度:<input id="height" class="easyui-numberbox" type="text" name="height" data-options="required:true"/>cm</td> 

</tr> 

<tr> 

<td> 

寬  度:<input id="width" class="easyui-numberbox" type="text" name="width" data-options="required:true"/>cm 

</td> 

</tr> 

<tr> 

<td> 

選擇圖片:<asp:FileUpload ID="idFile" Width="150px" runat="server" onchange="javascript:setImagePreview(this,localImag,preview);"> 

</td> 

</tr> 

<tr> 

<td> 

預  覽: 

<div id="localImag" style="width: 300px; height: 200px;"> 

<img id="preview" alt="預覽圖片" onclick="over(preview,divImage,imgbig);" src="../../Paint/img/default.jpg" width="300" height="200"/> 

</div> 

</td> 

</tr> 

</table> 

<input type="hidden" id="test" name="test" /> 

<div style="width:300px; text-align:center;"> 

<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">確定</a> 

<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">取消</a> 

</div> 

<%--顯示大圖標的區域--%> 

<div id="divImage" style="display: none;left:365px;top:40px;position: absolute"> 

<img id="imgbig" onclick="out();" src="" alt="大圖" /> 

</div> 

</div> 

</form>

JS代碼:

//顯示圖片 

function over(imgid, obj, imgbig) { 

//大圖顯示的最大尺寸 4比3的大小 400 300 

maxwidth = 400; 

maxheight = 300; 

//顯示 

obj.style.display = ""; 

imgbig.src = imgid.src; 

//1、寬和高都超過了,看誰超過的多,誰超的多就將誰設置為最大值,其余策略按照2、3 

//2、如果寬超過了并且高沒有超,設置寬為最大值 

//3、如果寬沒超過并且高超過了,設置高為最大值 

if (img.width > maxwidth && img.height > maxheight) { 

pare = (img.width - maxwidth) - (img.height - maxheight); 

if (pare >= 0) 

img.width = maxwidth; 

else

img.height = maxheight; 

else if (img.width > maxwidth && img.height <= maxheight) { 

img.width = maxwidth; 

else if (img.width <= maxwidth && img.height > maxheight) { 

img.height = maxheight; 

//隱藏圖片 

function out() { 

document.getElementById('divImage').style.display = "none"; 

//保存信息 

function submitForm() { 

$.messager.confirm('提示', '你確定要添加此記錄嗎?', function (r) { 

if (r) { 

//先上傳圖片后,再提交 

upLoadFile(); 

var test = document.getElementById("test").value = "add"; 

var paintingName = document.getElementById("paintingName").value; 

var artistID = document.getElementById("ddlist").value; 

var type = $(":checkbox[name='type']").attr("checked") == true ? "書法" : "國畫"; 

var price = document.getElementById("price").value; 

var height = document.getElementById("height").value; 

var width = document.getElementById("width").value; 

var idFile = document.getElementById("idFile").value; 

//先判斷是否上傳圖片之后在提交 

$('#ff').form('submit', { 

url: "Painting.ashx?paintingName=" + paintingName + "&artistID=" + artistID + 

"&type=" + type + "&price=" + price + "&height=" + height + "&width=" + width + 

"&idFile=" + idFile + "&addID=" + addID + "&test=" + test, 

dataType: "json", 

onSubmit: function () { 

return $(this).form('validate'); 

}, 

success: function (result) { 

if (result == "T") { 

//清空文本框 

document.getElementById("paintingName").value = ""; 

document.getElementById("price").value = ""; 

document.getElementById("height").value = ""; 

document.getElementById("width").value = ""; 

document.getElementById("idFile").value = ""; 

document.getElementById("preview").value = ""; 

$.messager.alert('提示', '恭喜您,信息添加成功!', 'info'); 

else { 

$.messager.alert('提示', '保存失敗,請您核對!', 'info'); 

}); 

}); 

//上傳圖片 

function upLoadFile() { 

var idFile = document.getElementById("idFile").value; 

//判斷是否選擇圖片 

if (idFile == null || idFile == "") { 

$.messager.alert('提示','請添加圖片!'); 

document.getElementById("idFile").focus(); 

document.getElementById("idFile").select(); 

return; 

var options = { 

type: "POST", 

url: 'Files.ashx', 

//success: showResponse 

}; 

// 將options傳給ajaxForm 

$('#ff').ajaxSubmit(options); 

//function showResponse() { 

// alert("上傳成功!"); 

//} 

function clearForm(){ 

//清空文本框 

document.getElementById("paintingName").value = ""; 

document.getElementById("price").value = ""; 

document.getElementById("height").value = ""; 

document.getElementById("width").value = ""; 

document.getElementById("idFile").value = ""; 

}

后臺一般處理程序的代碼:

上傳圖片的一般處理程序:

<span style="font-size:14px;"> /// <summary> 

/// Files 的摘要說明 

/// </summary> 

public class Files : IHttpHandler 

public void ProcessRequest(HttpContext context) 

context.Response.ContentType = "text/plain"; 

//圖片名 

HttpFileCollection files = context.Request.Files; 

if (files.Count > 0) 

for (int i = 0; i < files.Count; i++) 

HttpPostedFile file = files[i]; 

if (file.ContentLength > 0) 

//全路徑 

string FullFullName = file.FileName; 

//獲取圖片的名稱 

String fileName = FullFullName.Substring(FullFullName.LastIndexOf("\\") + 1); 

//保存路徑D:\GoodCommunitySystem2.0 - 副本\GoodCommunitySystem\Paint\img\ 

string path = "~/Paint/img"; 

file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path) + "\\" + fileName); 

public bool IsReusable 

get 

return false; 

}</span>

提交表單的一般處理程序:

/// <summary> 

/// Painting 的摘要說明 

/// </summary> 

public class Painting : IHttpHandler 

paintingBLL paintingbll = new paintingBLL(); 

Entity.paintingEntity paintingEntity = new Entity.paintingEntity(); 

public void ProcessRequest(HttpContext context) 

context.Response.ContentType = "text/plain"; 

string command = context.Request["test"].ToString();//前臺傳的標示值 

if (command == "add") 

Add(context); 

/// <summary> 

/// 添加記錄 

/// </summary> 

/// <param name="context"></param> 

public void Add(HttpContext context) 

paintingEntity.PaintingName = context.Request.QueryString["paintingName"]; 

paintingEntity.PaintingStyle = context.Request.QueryString["type"]; 

paintingEntity.PaintingURL = context.Request.QueryString["idFile"]; 

paintingEntity.Price = Convert.ToInt32(context.Request["price"]); 

paintingEntity.AddID = Convert.ToInt32(context.Request["addID"]); 

paintingEntity.ArtistID = Convert.ToInt32(context.Request["artistID"]); 

paintingEntity.Height = Convert.ToInt32(context.Request.QueryString["height"]); 

paintingEntity.Width = Convert.ToInt32(context.Request.QueryString["width"]); 

try

if (paintingbll.Add(paintingEntity)) 

context.Response.Write("T"); 

else

context.Response.Write("F"); 

catch (Exception ex) 

throw ex; 

public bool IsReusable 

get 

return false; 

}

需要引入的js:

<%--基礎樣式--%> 

<link href="../../themes/default/easyui.css" rel="stylesheet" /> 

<%--圖標樣式--%> 

<link href="../../themes/icon.css" rel="stylesheet" /> 

<%--easyui-js--js的文件有先有后min.js必須在前,easyui.min.js必須在后--%> 

<script src="../jquery.min.js"></script> 

<%--easyui 的js--%> 

<script charset="utf-8" src="../jquery.easyui.min.js"></script> 

<%--中文js--%> 

<script src="../locale/easyui-lang-zh_CN.js"></script> 

<%--上傳圖片時js--%> 

<script src="js/jquery.form.js"></script>

上傳圖片時,需要jquery.form.js的js文件,下載地址:http://download.csdn.net/detail/jiuqiyuliang/6919517

上傳圖片,并提交表單就是這么簡單,一些js代碼+一般處理程序,相信你一看就會。后面的博客我會更新一些關于easyui-datagrid的相關博客,敬請期待。

最近有網友,總覺得看的還不是太明白,能不能將paintingBLL和paintingEntity代碼貼一下-----新人求罩,我個人覺得實體層就沒有必要了,下面我就將paintingBLL的源碼粘一下,僅供大家參考。

using System; 

using System.Data; 

using System.Collections.Generic; 

using Common; 

using Entity; 

using DALFactory; 

using IDAL; 

namespace BLL 

/// <summary> 

/// paintingBLL 

/// </summary> 

public partial class paintingBLL 

private readonly IpaintingDAL dal=DataAccess.CreatepaintingDAL(); 

public paintingBLL() 

{}

#region BasicMethod 

/// <summary> 

/// 得到最大ID 

/// </summary> 

public int GetMaxId() 

return dal.GetMaxId(); 

/// <summary> 

/// 是否存在該記錄 

/// </summary> 

public bool Exists(int PaintingID) 

return dal.Exists(PaintingID); 

/// <summary> 

/// 增加一條數據 

/// </summary> 

public bool Add(Entity.paintingEntity Entity) 

return dal.Add(Entity); 

/// <summary> 

/// 更新一條數據 

/// </summary> 

public bool Update(Entity.paintingEntity Entity) 

return dal.Update(Entity); 

/// <summary> 

/// 刪除一條數據 

/// </summary> 

public bool Delete(int PaintingID) 

return dal.Delete(PaintingID); 

/// <summary> 

/// 刪除一條數據 

/// </summary> 

public bool DeleteList(string PaintingIDlist ) 

return dal.DeleteList(PaintingIDlist ); 

/// <summary> 

/// 得到一個對象實體 

/// </summary> 

public Entity.paintingEntity GetEntity(int PaintingID) 

return dal.GetEntity(PaintingID); 

/// <summary> 

/// 得到一個對象實體,從緩存中 

/// </summary> 

public Entity.paintingEntity GetEntityByCache(int PaintingID) 

string CacheKey = "paintingEntityEntity-" + PaintingID; 

object objEntity = Common.DataCache.GetCache(CacheKey); 

if (objEntity == null) 

try

objEntity = dal.GetEntity(PaintingID); 

if (objEntity != null) 

int EntityCache = Common.ConfigHelper.GetConfigInt("EntityCache"); 

Common.DataCache.SetCache(CacheKey, objEntity, DateTime.Now.AddMinutes(EntityCache), TimeSpan.Zero); 

catch{} 

return (Entity.paintingEntity)objEntity; 

/// <summary> 

/// 獲得數據列表 

/// </summary> 

public DataSet GetList(string strWhere) 

return dal.GetList(strWhere); 

/// <summary> 

/// 獲得數據列表 

/// </summary> 

public DataSet GetPaintingList(string strWhere) 

return dal.GetPaintingList(strWhere); 

/// <summary> 

/// 獲得前幾行數據 

/// </summary> 

public DataSet GetList(int Top,string strWhere,string filedOrder) 

return dal.GetList(Top,strWhere,filedOrder); 

/// <summary> 

/// 獲得數據列表 

/// </summary> 

public List<Entity.paintingEntity> GetEntityList(string strWhere) 

DataSet ds = dal.GetList(strWhere); 

return DataTableToList(ds.Tables[0]); 

/// <summary> 

/// 獲得數據列表 

/// </summary> 

public List<Entity.paintingEntity> DataTableToList(DataTable dt) 

List<Entity.paintingEntity> EntityList = new List<Entity.paintingEntity>(); 

int rowsCount = dt.Rows.Count; 

if (rowsCount > 0) 

Entity.paintingEntity Entity; 

for (int n = 0; n < rowsCount; n++) 

Entity = dal.DataRowToEntity(dt.Rows[n]); 

if (Entity != null) 

EntityList.Add(Entity); 

return EntityList; 

/// <summary> 

/// 獲得數據列表 

/// </summary> 

public DataSet GetAllList() 

return GetList(""); 

/// <summary> 

/// 分頁獲取數據列表 

/// </summary> 

public int GetRecordCount(string strWhere) 

return dal.GetRecordCount(strWhere); 

/// <summary> 

/// 分頁獲取數據列表 

/// </summary> 

public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) 

return dal.GetListByPage( strWhere, orderby, startIndex, endIndex); 

/// <summary> 

/// 分頁獲取數據列表 

/// </summary> 

//public DataSet GetList(int PageSize,int PageIndex,string strWhere) 

//{ 

//return dal.GetList(PageSize,PageIndex,strWhere); 

//} 

#endregion BasicMethod 

#region ExtensionMethod 

#endregion ExtensionMethod 

}

以上所述是小編給大家介紹的基于ASP.NET+EasyUI框架實現圖片上傳提交表單功能(js提交圖片),希望對大家有所幫助

更多信息請查看網絡編程
由于各方面情況的不斷調整與變化,易賢網提供的所有考試信息和咨詢回復僅供參考,敬請考生以權威部門公布的正式信息和咨詢為準!

2026上岸·考公考編培訓報班

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
云南網警備案專用圖標
聯系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網
云南網警報警專用圖標
中文字幕免费精品_亚洲视频自拍_亚洲综合国产激情另类一区_色综合咪咪久久
亚洲国产天堂久久国产91| 亚洲欧美日韩一区二区三区在线观看| 欧美日韩中文精品| 夜夜夜久久久| 欧美日韩成人在线观看| 99国产精品视频免费观看一公开| 免费成人高清在线视频| 亚洲第一毛片| 欧美日韩视频在线一区二区| 亚洲一区欧美二区| 影音先锋成人资源站| 免费看av成人| 羞羞色国产精品| 国产亚洲精久久久久久| 美玉足脚交一区二区三区图片| 亚洲伦理一区| 国语自产偷拍精品视频偷| 欧美大尺度在线观看| 久久久久久夜精品精品免费| 亚洲国产精品福利| 午夜精品在线看| 亚洲欧洲一区二区在线播放| 国产精品成人一区二区三区夜夜夜| 久久国产加勒比精品无码| 一本色道精品久久一区二区三区| 国产伦精品一区二区| 欧美视频一区二区在线观看| 美日韩在线观看| 久久久青草婷婷精品综合日韩| 亚洲综合色在线| 亚洲欧美综合一区| 午夜久久资源| 久久电影一区| 欧美 日韩 国产在线| 久久综合伊人77777蜜臀| 欧美夜福利tv在线| 久久尤物电影视频在线观看| 鲁大师成人一区二区三区 | 美女91精品| 久久久xxx| 欧美噜噜久久久xxx| 久热综合在线亚洲精品| 裸体一区二区| 欧美日韩免费在线| 欧美伦理一区二区| 在线观看国产精品网站| 欧美视频在线一区| 国产免费成人| 夜夜嗨av色一区二区不卡| 亚洲欧美激情视频| 欧美成人一区二区| 国产酒店精品激情| 99国产精品久久久久老师| 欧美一区三区二区在线观看| 欧美成年人视频| 国产区欧美区日韩区| 中国女人久久久| 9色porny自拍视频一区二区| 在线观看成人网| 一区二区三区视频在线看| 久久成人精品无人区| 国产精品国产三级国产aⅴ浪潮| 国产日韩精品视频一区二区三区| 黄色成人av网| 午夜欧美精品久久久久久久| 欧美日本一区| 亚洲精品一区二区三区四区高清| 亚洲精品一品区二品区三品区| 国产欧美日韩高清| 亚洲日本无吗高清不卡| 亚洲婷婷免费| 欧美日韩一区国产| 亚洲欧洲一区二区天堂久久 | 亚洲欧美日本日韩| 亚洲一区在线直播| 欧美日韩国产一区二区三区| 在线日本高清免费不卡| 久久久久久精| 激情久久久久久久| 亚洲最新合集| 国产精品视频久久久| 欧美专区在线观看| 经典三级久久| 欧美日韩天堂| 欧美一区影院| 国产香蕉97碰碰久久人人| 亚洲免费大片| 国产精品一区二区久久国产| 欧美一区二区在线播放| 尤物视频一区二区| 欧美日韩中文| 久久精品99国产精品| 日韩午夜黄色| 国产欧美一区二区精品婷婷| 噜噜噜躁狠狠躁狠狠精品视频| 亚洲午夜激情在线| 亚洲电影下载| 国产日韩一区二区三区在线播放| 你懂的亚洲视频| 久久国产精品高清| 亚洲欧美美女| 99视频精品| 亚洲国产毛片完整版| 国产色综合网| 国产日韩精品一区二区三区| 欧美成人有码| 欧美高清不卡| 欧美91福利在线观看| 裸体一区二区| 欧美国产一区二区在线观看| 久久午夜精品一区二区| 欧美精品成人91久久久久久久| 一本大道久久a久久综合婷婷 | 新狼窝色av性久久久久久| 麻豆精品一区二区综合av| 亚洲无线观看| 亚洲人成毛片在线播放| 伊人色综合久久天天| 极品日韩久久| 99精品热视频| 亚洲欧美日韩在线| 免费看黄裸体一级大秀欧美| 欧美搞黄网站| 国产精品久久久久9999高清| 国精产品99永久一区一区| 亚洲黄色成人| 欧美尤物巨大精品爽| 久久久久久久性| 欧美特黄a级高清免费大片a级| 久久国产婷婷国产香蕉| 亚洲午夜精品一区二区| 亚洲精一区二区三区| 欧美中文在线视频| 欧美午夜宅男影院在线观看| 亚洲高清资源| 久久九九全国免费精品观看| 欧美日韩亚洲一区二区| 91久久在线播放| 久久婷婷蜜乳一本欲蜜臀| 国产精品免费小视频| 亚洲视频日本| 国产精品成人一区二区三区夜夜夜 | 在线观看精品| 亚洲欧美日韩天堂| 欧美国产日韩精品| ●精品国产综合乱码久久久久| 亚洲欧美日韩国产成人精品影院| 欧美日韩国产成人在线观看| 亚洲欧洲中文日韩久久av乱码| 久久综合色一综合色88| 亚洲免费久久| 蜜桃av一区二区三区| 激情综合久久| 欧美国产激情| 亚洲天堂男人| 国产在线观看91精品一区| 久久中文字幕一区二区三区| 亚洲激情在线观看| 国产精品夜夜夜一区二区三区尤| 夜夜爽www精品| 国产一区香蕉久久| 国产精品久久久99| 欧美在线观看日本一区| 亚洲视频免费在线观看| 国内精品久久久久国产盗摄免费观看完整版| 激情综合网址| 国产精品自拍三区| 亚洲资源在线观看| 欧美日本一道本在线视频| 久久精品国产99精品国产亚洲性色 | 免费成人av在线看| 欧美日韩综合不卡| 国语精品中文字幕| 亚洲一区二区在线看| 欧美91大片| 欧美中文字幕在线视频| 在线欧美小视频| 国产精品美女久久久免费| 欧美 日韩 国产 一区| 欧美午夜一区二区福利视频| 国产精品成人一区二区三区吃奶 | 国产日韩av一区二区| 欧美va亚洲va香蕉在线| 亚洲视频一二| 一区二区91| 一本到高清视频免费精品| 亚洲黄色在线观看| 日韩视频不卡| 中日韩午夜理伦电影免费| 夜夜嗨一区二区| 亚洲欧美日韩中文播放| 亚洲女女女同性video| 亚洲一区二区三区视频| 久久xxxx精品视频| 久久久免费观看视频| 欧美mv日韩mv国产网站| 欧美国产日韩a欧美在线观看| 欧美日韩国语| 国内精品美女av在线播放| 在线日韩欧美|