Time of Update: 2018-12-08
伺服器控制項顯示圖片問題不大,會自動顯示相對位置, 非伺服器控制項有兩種方法解決: 1. Request.ApplicationPath + 圖片路徑(images/xxx.gif) : 資料庫裡 圖片路徑以檔案夾名開頭 2. ResolveClientUrl("(~/images/xxx.gif") : 資料庫裡 圖片路徑為(~/開頭) 注意: ResolveClientUrl 返回相對於當前頁面下檔案的地址 ResolveUrl 則返回頁面所在應用程式下的相對位址
Time of Update: 2018-12-08
比如每天淩晨七點的時候email發送一次報表。 這裡首先想到的就是利用 Global.asax 檔案來實現, 以下Global檔案的內容。 複製代碼 代碼如下:<%@ Application Language="C#" %> <%@ Import Namespace="System.Threading" %> <script runat="server"> //這裡使用靜態保持對這處Timer執行個體的引用,以免GC private static
Time of Update: 2018-12-08
--前台 複製代碼 代碼如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Successed.aspx.cs" Inherits="Biz_Order_Successed" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
Time of Update: 2018-12-08
在html頁中,定義了TextBox控制項, 複製代碼 代碼如下:<td align="center" style="width: 183px; height: 25px"> 緯度:<asp:TextBox ID="TextBox_l" runat="server" Width="76px"></asp:TextBox> 經度:<asp:TextBox ID="TextBox_2" runat="server" Width="95px"></
Time of Update: 2018-12-08
複製代碼 代碼如下:#region 方法一: DataTable tblDatas = new DataTable("Datas"); DataColumn dc = null; dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32")); dc.AutoIncrement = true;//自動增加 dc.AutoIncrementSeed = 1;//起始為1 dc.AutoIncrementStep = 1;//步長為1
Time of Update: 2018-12-08
複製代碼 代碼如下:if (!IsPostBack) { //一級分類列表 this.DropDownList1.DataSource = dsbb.SelectSubjct1(); this.DropDownList1.DataTextField = "cName"; this.DropDownList1.DataValueField = "Ccode"; this.DropDownList1.DataBind(); this.DropDownList1.Items.Insert(0,new
Time of Update: 2018-12-08
複製代碼 代碼如下:using System; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using
Time of Update: 2018-12-08
伺服器控制項雖然用起來方便,但是也犧牲了效能,有些時候用起來顯得大而無當。希望先進朋友多多指教。複製代碼 代碼如下:/// <summary> /// 工程業績--用for迴圈代替了DataList多列顯示,得到2行四列的表格,需要記憶體表的8行資料 /// </summary> private void GcyjShow() { StringBuilder sb = new StringBuilder(); ProductBLL pb = new ProductBLL(
Time of Update: 2018-12-08
複製代碼 代碼如下:using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using
Time of Update: 2018-12-08
在這裡我給大家介紹或者說是展示一下我自己的做的兩種模態對話方塊方法一 本方法是採用ASP.NET AJAX的擴充控制項:ASP.NET AJAX Control Tool Kit中的ModalPopupExtender控制項實現的: 第一步,我們先建立一個ASP.NET頁面:ModalPopup.aspx 頁面代碼: 複製代碼 代碼如下:<%@ Page Language="C#" AutoEventWireup="true"
Time of Update: 2018-12-08
前台代碼: 複製代碼 代碼如下:<asp:GridView ID="GridLog" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ID" BorderColor="#333" BorderStyle="solid" BorderWidth="1" OnRowDeleting="PublicGridRowDeleting" GridLines="None" Width="98%"
Time of Update: 2018-12-08
其主要的優點便是無需再手工添加大量的資訊了,可以指定對某一個站資訊的截取進行批量錄入,達到省時省力的目的。與其單純的ASP小偷程式不同的是:它已經不再依賴其目標網站。 參考代碼: 複製代碼 代碼如下:<% '聲明取得目標資訊的函數,通過XML組件進行實現。 Function Geturl(/blog/url) Set Retrieval = CreateObject("Microsoft.XMLHTTP") With Retrieval .Open "GET", url, False
Time of Update: 2018-12-08
方法一: 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: 2018-12-08
在網上搜了一下事件執行順序,並經過測試在有分頁的情況下是不正確的。事件執行順序: 一、GridView 顯示繫結資料(預設為5行): 複製代碼 代碼如下:DataBinding RowCreated:Header[0] RowDataBound RowCreated:DataRow[1] RowDataBound RowCreated:DataRow[2] RowDataBound RowCreated:DataRow[3] RowDataBound RowCreated:DataRow[4]
Time of Update: 2018-12-08
IIS收到請求-->ISAPI用於處理該請求-->BeginRequest開始-->EndRequest結束-->輸出Response 中間有好多其它的流程就不標記了,這裡只是列出URLRewrite所走的流程。 其實就是在BeginRequest事件中調用HttpContext的RewritePath方法,將該請求重新“定位”至一個目標URL就完成了。 在網站的Global.asax檔案BeginRequest方法中添加代碼: 複製代碼 代碼如下:public
Time of Update: 2018-12-08
1. 添加CSS樣式: Style style = new Style(); style.ForeColor = System.Drawing.Color.Navy; style.BackColor = System.Drawing.Color.LightGray; this.Header.StyleSheet.CreateStyleRule(style, null, "body"); 2. 連結外部的CSS樣式表: HtmlLink link = new HtmlLink();
Time of Update: 2018-12-08
1、OWC11 這個控制項全稱是:Office Web Component 11,是office2003中的一個組件,可惜的是office2007中沒有了它的身影。不過安裝office2003之後可以引用,然後使用。使用過的人都知道,就是它的效果要差一點。 2、dotnetCharting http://www.dotnetcharting.com/
Time of Update: 2018-12-08
3種方法分別是: string a=""; 1.if(a=="") 2.if(a==String.Empty) 3.if(a.Length==0) 3種方法都是等效的,那麼究竟那一種方法效能最高呢?本人用實驗說明問題。 建立3個aspx頁面(為什麼用網頁,主要是利用Microsoft Application Center Test ) WebForm1.aspx 複製代碼 代碼如下:private void Page_Load(object sender, System.EventArgs e)
Time of Update: 2018-12-08
複製代碼 代碼如下:<% '================================================================ '= 系統版本:1.0 = '= 檔案版本:1.0 = '= 文本建立日期:2005-10-31
Time of Update: 2018-12-08
複製代碼 代碼如下:public string GetRandomColor() { Random RandomNum_First = new Random((int)DateTime.Now.Ticks); // 對於C#的隨機數,沒什麼好說的 System.Threading.Thread.Sleep(RandomNum_First.Next(50)); Random RandomNum_Sencond = new Random((int)DateTime.Now.Ticks); //