ÔÚAJAXÖдÓGridView±íÖÐÎÞ·¨µ¼³öExcel±í¸ñµÄÎÊÌâ
Õ⼸Ì칤×÷£¬ÓõÄÊÇAJAX¿ò¼Ü£¬½á¹ûµ¼³öExcel±í¸ñµÄʱºòÎÞ·¨µ¼³ö¡£
½â¾ö°ì·¨£º1¡¢ÔÚ.aspxÒ³ÃæÊ×ÐÐÖÐ<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JinHuoDan.aspx.cs" Inherits="out_store_JinHuoDan" %> Ìí¼ÓEnableEventValidation="false" £»
2¡¢ÔÚUPdatePanelÖÐÌí¼Ó</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Out_excel" />//ÕâÀïµÄIDÖ¸µÄÊÇÄãµ¥»÷µ¼³öExecelµÄ¿Ø¼þ£¬Ê¹Õâ¸ö¿Ø¼þ»Ø·¢¡£
</Triggers>
</asp:UpdatePanel> £»
3¡¢µ¼³öEXCELµÄ´úÂ룺 Response.Clear();
Response.Charset = "GB2312";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.ContentType = "application/ms-excel";
System.IO.StringWriter ostrwriter = new System.IO.StringWriter();
HtmlTextWriter ohtwriter = new HtmlTextWriter(ostrwriter);
this.GridView1.RenderControl(ohtwriter);
Response.Output.Write(ostrwriter.ToString());
Response.Flush();
Response.End();
²¢ÇÒÌí¼Ó´úÂëÐУº public override void VerifyRenderingInServerForm(Control control)
{
}
//ÕâÐдúÂëÊÇҪȷÈÏÔËÐÐʱָ¶¨µÄ·þÎñÆ÷¿Ø¼þ³ÊÏÖ£¬Ò»¶¨ÒªÌí¼Ó
ÔËÐнâ¾öÎÊÌâ
Ïà¹ØÎĵµ£º
1.ʲôÊÇAjax?
AjaxµÄÈ«³ÆÊÇ£ºAsynchronous + JavaScript+XML --------------------> Òì²½µÄ(²»Í¬Ê±µÄ) javascript ¼° xml
2.AjaxµÄ¶¨Ò壺
Ajax²»ÊÇÒ»¸ö¼¼Êõ£¬Ëüʵ¼ÊÉÏÊǼ¸ÖÖ¼¼Êõ£¬Ã¿ÖÖ¼¼Êõ¶¼ÓÐÆä¶ÀÌØÕâ´¦£¬ºÏÔÚÒ»Æð¾Í³ÉÁËÒ»¸ö¹¦ÄÜÇ¿´óµÄм¼Êõ¡£
3.Ajax°üÀ¨£º
XHTMLºÍCSS
ʹÓÃÎĵµ¶ ......
ͨ¹ýXMLHttpRequest.responseXML;
½«ÏìÓ¦½âÎöΪXML
»ñµÃ¶ÔÏóÓÐÏÂÃæµÄÊôÐԺͷ½·¨
±í3-1 ÓÃÓÚ´¦ÀíXMLÎĵµµÄDOMÔªËØÊôÐÔ
ÊôÐÔÃû
ÃèÊö
childNodes
·µ»Øµ±Ç°ÔªËØËùÓÐ×ÓÔªËØµÄÊý×é
firstChild
·µ»Øµ±Ç°ÔªËصĵÚÒ»¸öϼ¶×ÓÔªËØ
lastChild
·µ»Øµ±Ç°ÔªËصÄ×îºóÒ»¸ ......
<style type="text/css">
<!--
.STYLE1 {
font-size: 24px;
font-weight: bold;
}
.STYLE2 {font-size: 36px}
-->
.mouseOut {
color: #000000;
}
.mouseOver {
&nb ......
ÉÏ´«Ò³ÃæÖ»ÐèÒªÒ»¸öjsÒýÓúÍjsº¯ÊýµÄµ÷Ó㬼òµ¥·½±ã£¬²»Ó°ÏìÍøÒ³ÔÓв¼¾Ö¡£
ÏÂÔØµØÖ·
µ÷ÓÃ˵Ã÷:
1.Ê×ÏÈÒýÓÃjsÎļþ
<script type="text/javascript" src="AienUpload/init.js"></script>
2.½«º¯Êýµ÷ÓÃ(showUpload(boxCtrl,inputCtrl,upPath,maxCount,fn);)°ó¶¨µ½HTMl¿Ø¼þʼþ£¬ÀýÈç
......
¡¡¡¡Ê×Ïȼì²éWeb.configÎļþÀïÊÇ·ñÊÇÈçÏ´úÂ룺
¡¡¡¡´ò¿ªVS2005´´½¨ÐÂÏîÄ¿£¬Ñ¡ÔñASP.NET¡¡AJAXÏîÄ¿£¬È»ºó°Ñ¸ÃÏîÄ¿Web.configÎļþµÄÄÚÈÝÈ«²¿¸´ÖƵ½Ä㱨´íµÄWeb.configÎļþÀï¡£
¡¡¡¡Èç¹ûÕâ¸ö°ì·¨Î´Äܽâ¾ö°ì·¨Çë²é¿´¸ÃÏîÄ¿¸ùĿ¼µÄBinÎļþ¼ÐÄÚÊÇ·ñÓÐSystem.Web.Extensions.Design.dll¡¢System.Web.Extensions.dll¡¢A ......