Time of Update: 2017-01-19
使用AjaxMethod要滿足一下幾點: 1。如果還沒有ajax.dll檔案,就先下載一個來 2。將ajax.dll添加到項目引用中:在VS的方案總管中右鍵點擊項目名稱--“添加項目引用”--瀏覽,找到ajax.dll確定 3。webCofig中<httpHandlers>加上<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>節點
Time of Update: 2017-01-19
1. 需要引用的類庫 複製代碼 代碼如下: using System.Net; using System.IO; using System.Text; using System.Text.RegularExpressions; 2. 擷取其他網站網頁內容的關鍵代碼 複製代碼 代碼如下: WebRequest request = WebRequest.Create("http://目標網址.com/"); WebResponse response = request.GetResponse();
Time of Update: 2017-01-19
複製代碼 代碼如下: public partial class ExcelHelper : IDisposable { #region Fileds private string _excelObject = "Provider=Microsoft.{0}.OLEDB.{1};Data Source={2};Extended Properties=\"Excel {3};HDR={4};IMEX={5}\""; private string _filepath = string.Empty;
Time of Update: 2017-01-19
複製代碼 代碼如下: <appSettings> <!-- 連接字串是否加密 --> <add key="ConStringEncrypt" value="false"/> <!-- 連接字串,(可以擴充支援不同資料庫)如果是加密方式,上面一項要設定為true,如果是明文server=127.0.0.1;database=codematic;uid=sa;pwd=,上面設定為false --> <add
Time of Update: 2017-01-19
現在,藉助於.NET4.0中的OutputCacheProvider,我們可以有多種選擇建立自己的緩衝。如,我們可以把HTML輸出緩衝儲存到memcached分布式叢集伺服器,或者MongoDB中(一種常用的面向文檔資料庫,不妨閱讀本篇http://msdn.microsoft.com/zh-cn/magazine/gg650661.aspx)。當然,我們也可以把緩衝作為檔案儲存體到硬碟上,考慮到可擴充性,這是一種最廉價的做法,本文就是介紹如果構建自訂檔案快取。
Time of Update: 2017-01-19
方法一: 在asp.net的aspx裡面的原始碼中 <input type="button onclick="javascript:window.history.go(-1);"value="返回上一頁"> 淺析:這個是用了HTML控制項,通過一個onclick的事件,調用了javascript中的一個方法就可以了。這個是最簡單的了,也同樣適用於靜態頁面,ASP頁面等。 方法二: 利用Reponse.write
Time of Update: 2017-01-19
複製代碼 代碼如下: private string toadd = "├".<BR><BR>private void GetArticleCategory(string pid) { SqlConnection conn = new SqlConnection("server=.;database=test;uid=sa;pwd=;"); string sql = "select Articlesgroup_id,Groupname from Articlesgroup
Time of Update: 2017-01-19
複製代碼 代碼如下://開啟新的表單 Response.Redirect("WebMain.aspx"); //彈出一個新表單 Response.Write("<script>window.open(\"WebMain.aspx\")</script>") //彈出一個只有確定按鈕的提示框 Response.Write("<script>alert(\"使用者名稱或密碼錯誤\");</script>"); //關閉表單不提示資訊 Response.
Time of Update: 2017-01-19
1.在Server端添加Silverlight-enabled WCF service 複製代碼 代碼如下:[ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Service1 { [OperationContract] public void
Time of Update: 2017-01-19
方法一 :使用XML控制項 代碼 複製代碼 代碼如下: <% @ Page Language="C#"%> <html> <body> <h3><font face="Verdana">讀取XML方法一</font></h3> <from runat=server> <asp:Xml id="xml1" DocumentSource="grade.xml" runat="server"
Time of Update: 2017-01-19
先看看ASP.NET頁面重新整理的實現方法: 第一: C# code private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } 第二: C# code private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " <
Time of Update: 2017-01-19
方法一: Home/Index.aspx中的代碼 複製代碼 代碼如下: <% using (Html.BeginForm("up","Home",FormMethod.Post,new{enctype="multipart/form-data"})) {%> <input type="file" name="upfile" /> <input type ="submit" name ="upload" value ="上傳" /> <%} %>
Time of Update: 2017-01-19
複製代碼 代碼如下:public class SqlOperation { #region 屬性 /// <summary> /// 儲存在Web.config中的連接字串 /// </summary> protected static string connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["hao"].ConnectionString; /// <
Time of Update: 2017-01-19
預設支援兩個參數: width寬度,default value :250px link 要link的URL對應的Source code是: 複製代碼 代碼如下: var params = parseQuery( queryString ); if(params['width'] === undefined){params['width'] = 250}; if(params['link'] !== undefined){ $('#' +
Time of Update: 2017-01-19
複製代碼 代碼如下: protected void btnSort_Click(object sender, EventArgs e) { string array1 = txtSort.Text.Trim(); string[] array21=array1.Split(','); int dxiao = array21.Length; int[] array = new int[dxiao]; int temp=0; for (int i = 0; i < array.Length;
Time of Update: 2017-01-19
通過這個軟體一兩天就完成了幾千產品資料的錄入,可見很多工作不是一味用人工去做,作為一個程式員,就是要讓很多讓那些經常做重複性的、繁瑣的工作中的人解放出來。下面只是寫了一些核心代碼,而且採集必須要和對應網站相掛鈎,作者:鄭少群複製代碼 代碼如下: //提取產品列表頁中產品最終頁的網頁 private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Trim() == "" ||
Time of Update: 2017-01-19
一個是一個頁面轉換的類,該類通過靜態函數Changfile()來實現,動態網頁面到靜態頁面的轉換。 複製代碼 代碼如下: using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.
Time of Update: 2017-01-19
前台代碼: 代碼 複製代碼 代碼如下: <div id="newslistdiv"> <asp:DataList ID="NewsList" runat="server" Width="820px"> <HeaderTemplate> <div> <img src="../loginimages/newslisthead.gif" alt="" /></div> </HeaderTemplate>
Time of Update: 2017-01-19
一.儲存圖片到XML檔案 複製代碼 代碼如下: /// <summary> /// 儲存圖片到XML檔案 /// </summary> private void UploadImageToXml() { ///得到使用者要上傳的檔案名稱 string strFilePathName = loFile.PostedFile.FileName; string strFileName = Path.GetFileName(strFilePathName); int
Time of Update: 2017-01-19
原本準備在上一篇中直接修改的,無奈編輯功能太差,開啟一堆html代碼,空格“ ”都看的人眼花繚亂,只好另開一篇。 升級說明:添加了針對一個介面多個職能提示位置的設定,只需修改文字框onfocus="fnStartInterval(this,'DropDownList2')",