ÔÚUpdatePanelÉÏʹÓÃFileUploadÉÏ´«Îļþ (asp.net C#)
Ê×ÏÈÎÒºÜÒź¶µÄ¸æËß´ó¼Ò£¬ÒòΪ΢ÈíµÄ͵ÀÁ£¬Ä¿Ç°UpdatePanel»¹²»Ö§³ÖÎļþÉÏ´«¡£±äÏàµÄ½â¾ö°ì·¨¾ÍÊÇUpdatePanelÖÐÉèÖÃPostBackTrigger£º
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="ÉÏ´«" OnClick="Button1_Click" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
¶øÈç¹ûÄãÓÖÏëÔÚÕâ¸öUpdatePanelÉÏ×öµã»¨Ñù£¬±ÈÈç¼ÓÁËÒ»¸öasp:Panel, ¿ÉÒÔͨ¹ý°´Å¥Ê¼þ´¥·¢Òþ²Ø»òÏÔʾµÄ£¬Äã»á·¢ÏÖFileUpload1²¢²»ÄÜÕÒµ½Îļþ¡£¡£¡£
ÆäʵµÀÀíºÜ¼òµ¥£¬UpdatePanelÖеÄÄÚÈÝÊÇͨ¹ýXmlHttpʵʱÌî³äµÄ£¬ÔÚÄãÈÃËûÏÔʾ֮ǰ£¬²é¿´Ò³ÃæÔ´´úÂëÀïÃæÊǿյġ£Ò»¸ö¶¯Ì¬¿Ø¼þ¸üÐÂ
ÆÕͨÊý¾ÝûÎÊÌ⣬µ«ÉÏ´«Îļþ¾Í²»ÐÐÁË£¬ÎҵĽâ¾ö°ì·¨ÊÇÓÃÆÕͨdiv´úÌæasp:Panel,²¢Ð´ÁË2¸öº¯ÊýÀ´¶¯Ì¬·¢ËÍ¿ØÖƽű¾£¬°´Å¥Ê¼þÖÐÖ»Òªµ÷Óøú¯Êý
¼´¿É£º
<div id="Panel1"></div>
private void ShowPanel()
{
string script = "document.getElementById('Panel1').style.display='';";
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ShowPanel", script, true);
}
private void ClosePanel()
{
string script = "document.getElementById('Panel1').style.display='none';";
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ClosePanel", script, true);
}
Ïà¹ØÎĵµ£º
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
/// <summary>
/// һЩ³£ÓõÄJsµ÷ÓÃ
/// Ìí¼Óаæ˵Ã÷£ºÓÉÓھɰæÆÕ±é²ÉÓÃResponse.Write(string msg)µÄ·½Ê½Êä³öjs½Å±¾£¬ÕâÖÖ
/// ·½Ê½Êä³öµÄjs½Å±¾»áÔÚhtmlÔªËصÄ<html>&a ......
1£©´´½¨txtÎļþ¡¾web.config¡¿
--------------------------------------------------------------------
<appSettings>
<add key="EditChars" value="D:\Site\ZJPS\TextFile\EditChars.txt"/>
</appSettings>
2) Ò³ÃæµÄCSÎļþÖУº
----------------- ......
JavaScriptʵÏÖ£º
<mce:script type ="text/javascript" ><!--
function readWord()
{
var div1=document .getElementById ("div1");
var WordApp,WordDoc,Str;
WordApp =new ActiveXObject ("Word.application");
WordDoc =WordApp.Documents.Open("F:\\¹¤×÷ÈÕÖ¾.doc");
......
ÏÂÃæÒÔTest Õ¾µãΪÀý£¬ËµÃ÷Ò»ÏÂÈçºÎÉèÖà .net framework 2.0 aspnet_isapi µÄ IIS ÉèÖÃ
°´Èçϲ½Öè²Ù×÷¼´¿É
1¡¢´ò¿ªÕ¾µã£¬ÓÒ»÷ÊôÐÔ£¬ÕÒµ½Ö÷Ŀ¼£¨±¾Ê¾ÀýÊÇÒÔÐéÄâĿ¼£¬·þÎñÆ÷°æ±¾ÇëÕÒÖ÷Ŀ¼£©
´ò¿ªÈçÏÂͼËùʾµÄ´°¿Ú
......
µ±Ò»¸öÍøÒ³ÖмÈÓÐÊý¾ÝÑéÖ¤¿Ø¼þ£¬ÓÖÓÐÒ»¸ö°´Å¥ÔÚµã»÷ʱ³öÏÖÌáʾ°´Å¥¡£
Èç¹ûÖ±½ÓÔÚÒ³ÃæµÄºǫ́´úÂëµÄPage_Loadº¯ÊýÖÐдÈëbtn.Attributes["Onclick"] = "return confirm('È·¶¨Òª±£´æÊý¾Ý£¿')"£¬ÄÇôÑéÖ¤¿Ø¼þ¾Í»áʧЧ£¬ÒòΪÑéÖ¤¿Ø¼þÒ²ÊÇͨ¹ýjsʵÏֵģ¬ÕâÑùµÄ»°return confirm('È·¶¨Òª±£´æÊý¾Ý£¿')ÏÈÓÚÔÀ´µÄjs´úÂëÖ´ÐУ¬Ì ......