Time of Update: 2018-12-06
<html><head><title> ASP.NET 列印 - 所見即所得 (WYSIWYG) </title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script language="javascript">function preview(){ bdhtml=window.document.body.innerHTML;
Time of Update: 2018-12-06
Email.aspx:Email.aspx.cs:using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using
Time of Update: 2018-12-06
分頁這個也是最多人問的,也是很基礎很實用的。網上有很多分頁代碼,要不是有前台就沒後台,要不是有後台沒前台,要不是就是控制項,要不就是一大堆SQL代碼,讓人不知道怎樣用。力求最簡單最易懂.三層架構那些就不搞了。自己下載一個如果是access 就用這個SQLHELPER
Time of Update: 2018-12-06
CodeCode highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-06
讀取固定xml檔案: <?xml version="1.0" encoding="utf-8"?><xml><AO> <string>A</string> <string>B</string> <string>C</string> <string>D</string>
Time of Update: 2018-12-06
genimage.ashx<%@ WebHandler Language="C#" Class="netpix.ImageGenerator" %> genimage.ashx.cs// Copyright (C) 2003 by Greg Ennis// (mailto:greg@ennis.net)//// The contents of this file are subject to the Artistic License (the "License").// You ma
Time of Update: 2018-12-06
string sqlstr = "select * from ExtendMail where UserID= 1"; DataSet ds = new DataSet(); ds = userinfo.GetDateSet(sqlstr, "tab"); for (int i = 0; i < ds.Tables["tab"].Rows.Count; i++) { //文字框 TextBox myTextBox = new TextBox(); myTextBox.ID =
Time of Update: 2018-12-06
5. 同時具有傳回值、輸入參數、輸出參數的預存程序 前面說過,在調用預存程序時,聲明參數的順序要與預存程序中定義的順序相同。還有一點要特別注意:如果預存程序同時具有傳回值以及輸入、輸出參數,傳回值要最先聲明。 為了示範這種情況下的調用方法,我們改善一下上面的例子。還是取得ID為1的使用者的使用者名稱,但是有可能該使用者不存在(該使用者已刪除,而userid是自增長的欄位)。預存程序根據使用者存在與否,返回不同的值。此時,預存程序和ASP代碼如下: /*SP5*/
Time of Update: 2018-12-06
開發平台是2003,所用控制項是Repeaterusing System;using System.Data;using System.Data.SqlClient;namespace Pagination.Class{ /// <summary> /// Pager 的摘要說明。 /// </summary> public class Pager { public Pager() { // // TODO: 在此處添加建構函式邏輯 // }
Time of Update: 2018-12-06
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.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class
Time of Update: 2018-12-06
對於asp.net程式,我們應該儘可能的提供一個便捷的使用者介面,減少頁面回傳就是其中之一。本文示範一次上傳多個檔案的方法,在用戶端可以隨意控制上傳檔案的個數,但是注意總檔案大小不能過大,否則會有異常拋出。至於解決大檔案上傳的方法已經超出本文的討論範圍。這裡有一個要點大家不要忽略了,否則程式不能正常工作。就是必須指定form的enctype="multipart/form-data" 屬性代碼如下:<%@ Page language="c#"
Time of Update: 2018-12-06
第一種方法:向伺服器的動態網頁面發送請求,擷取頁面的html代碼。這種方法缺點顯而易見:速度慢。另外如果請求的動態網頁面有驗證控制項的話,返回的html頁面卻無法進行資料驗證。但這種方法寫起來比較簡單。主要代碼如下:#region//產生被請求URL靜態頁面public static void getUrltoHtml(string Url,string Path)//Url為動態網頁面地址,Path為產生的靜態頁面{try{ System.Net.WebRequest wReq =
Time of Update: 2018-12-06
類LineChartpublic class LineChart{ public Bitmap b; public string Title = "在ASP.NET中實現資料圖表"; public ArrayList chartValues = new ArrayList(); public float Xorigin = 0, Yorigin = 0; public float ScaleX, ScaleY; public float
Time of Update: 2018-12-06
使用QueryString使用QuerySting在頁面間傳遞值已經是一種很老的機制了,這種方法的主要優點是實現起來非常簡單,然而它的缺點是傳遞的值是會顯示在瀏覽器的地址欄上的(不安全),同時又不能傳遞對象,但是在傳遞的值少而安全性要求不高的情況下,這個方法還是一個不錯的方案。使用這種方法的步驟如下:1,使用控制項建立web表單(form)2,建立可以返回表單的按鈕和連結按鈕3,在按鈕或連結按鈕的單擊事件裡建立一個儲存URL的字元變數4,在儲存的URL裡添加QueryString參數5,使用Re
Time of Update: 2018-12-06
傳送<asp:HyperLink id=lkEdit NavigateUrl=' <%#
Time of Update: 2018-12-06
protected void Button1_Click(object sender, EventArgs e) { string url = "http://" + Request.Url.Authority + "/default.aspx"; new System.Net.WebClient().DownloadFile(url, Server.MapPath("~/default.html")); Response.Redirect("default.html");
Time of Update: 2018-12-06
g.DrawRectangle(new Pen(Color.White, 400), 0, 0, img.Width, img.Height); //定義黑色過渡型筆刷 LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, img.Width, img.Height), Color.Black, Color.Black, 1.2F, true);
Time of Update: 2018-12-06
C# codeprotected override void OnStart(string[] args) { MyTimer(); } //執行個體化System.Timers.Timer private void MyTimer() { //設定時間間隔 System.Timers.Timer MT = new
Time of Update: 2018-12-06
效果如下:這裡是從Dataset裡的資料產生曲線圖.我的Dataset是從表Sendrec裡讀取的資料,分別有Id,Sendid(訂單號),Sendtime(記錄時間),Sendnum(單位時間發送量/我這裡是五分鐘)幾個欄位過程如下:public void draw(Page page,DataSet ds,int
Time of Update: 2018-12-06
Request.ApplicationPath/Request.PhysicalPathD:\Projects\Solution\web\News\Press\Content.aspxSystem.IO.Path.GetDirectoryName(Request.PhysicalPath)D:\Projects\Solution\web\News\PressRequest.PhysicalApplicationPathD:\Projects\Solution\web\System.IO.Path