Time of Update: 2018-12-08
前段時間遇到了需要禁用重新整理的需求,f5按鈕就不說了,簡單的js就能把它禁用,但是工具條上的重新整理按鈕卻傻傻幹不掉。如果簡單的在重新整理時重新載入畫面,通過window.location.href="url"可以很容易的實現,但是需求是要求在重新整理時什麼都不做,保留畫面的狀態,這下子可就複雜化了。 asp.net中分辨請求是重新請求還是通過重新整理按鈕再次請求不是很方便,為了實現這個效果,試過了很多的方式,一下面的兩種為例 1. 複製代碼 代碼如下:private bool
Time of Update: 2018-12-08
想用asp來實現後台添加wma視頻檔案,前台顯示所添加的這個視頻檔案。 可以實現的asp代碼如下: 複製代碼 代碼如下:<table border=1 cellPadding=4 cellSpacing=0 width=500 align=center> <tr> <td width="236" align=center class=tdc1></td> </tr> <% lurl="phage1.wma" %>
Time of Update: 2018-12-08
前言 建立Asp.net MVC4項目的時候,在Global.asax.cs裡面發現多了一句代碼 BundleConfig.RegisterBundles(BundleTable.Bundles) google了以後終於弄清楚了這個的作用,發現這個東西確實非常實用,且功能強大,能夠壓縮合并js和CSS,但是目前的使用起來不是特別好,如果添加js或者css檔案的話,需要修改BundleConfig的代碼。 這裡我自己簡單修改了BundleConfig,對這個進行簡單的擴充。 下面貼出代碼:
Time of Update: 2018-12-08
如果為了方便與簡單的測試可以用簡易的asp運行環境,可以到http://www.jb51.net/softs/28133.html下載,一般的網站是沒問題的,如果比較複雜的就需要用iis了。這裡以win2003
Time of Update: 2018-12-08
改造辦法是自己寫一個控制項,讓它繼承GridView或Repeater,並實現IPageableItemContainer 介面。下面要發的是國外某高手寫的代碼,測試有效。具體使用的時候,要建一個類庫項目,把代碼編譯成dll後,就可以添加到VS的工具箱裡了! 一、自訂Repeater 複製代碼 代碼如下:using System.Web.UI; using System.Web.UI.WebControls; namespace WYJ.Web.Controls { ///
Time of Update: 2018-12-08
頁面樣式代碼: 複製代碼 代碼如下:<style type="text/css"> .header { background-color: #CCCCCC; color: White; font-size: x-large; } .content { background-color: White; font-weight: lighter; font-size: small; } .content td { text-align: left; } .mandatory {
Time of Update: 2018-12-08
這裡我們舉例校正ListBox兩個規則: •校正必選項 •選擇範圍在0~4項 介面代碼: 複製代碼 代碼如下:<form id="form1" runat="server"> <div align="center"> <fieldset style="width: 350px; height: 200px;"> <table border="0" cellpadding="3" cellspacing="3"> <tr> <td&
Time of Update: 2018-12-08
ASP: 複製代碼 代碼如下:<% Option Explicit Response.Buffer = true Response.ContentType = "text/html" Response.Charset = "gb2312″ Dim Url, Result Url = "http://ping.baidu.com/ping/RPC2" Result = BytesToBstr(SendPing(Url), "gb2312″) IF Instr(Result,
Time of Update: 2018-12-08
首先是資料表的設計其中treeId指的是該功能表項目的父ID,如果treeId為0.表示該功能表項目為根功能表項目,否則表示他為某功能表項目的子功能表,比如id為2的項,他的父節點是1.則他是張三的子功能表,而張三是根菜單,position只用於根功能表項目,用於控制顯示的順序。 往網頁裡拖入一個menu控制項,然後添加代碼 複製代碼 代碼如下:using System; using System.Data; using System.Configuration; using
Time of Update: 2018-12-08
1.操作Excel的動態連結程式庫 2.建立操作動態連結程式庫的共通類,方便調用。(ExcelHelper) 具體如下: 複製代碼 代碼如下:using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls;
Time of Update: 2018-12-08
複製代碼 代碼如下:<% '============================================================ ' 檔案名稱 : /Cls_Json.asp ' 檔案作用 : 系統JSON類檔案 ' 檔案版本 : VBS JSON(JavaScript Object Notation) Version 2.0.2 ' 程式修改 : Cloud.L ' 最後更新 : 2009-05-12 '================================
Time of Update: 2018-12-08
複製代碼 代碼如下:<% '//hittime 日期型:獲得上次訪問時間 '//hits 數字型:獲得總瀏覽量 '//hitsday 數字型:獲得今天瀏覽量 '//hitsweeks 數字型:獲得本周瀏覽量 '//hitmonths 數字型:獲得本月瀏覽量 '資料庫中 添加這5個欄位。 set rs1=server.CreateObject("adodb.recordset") rs1.open "select * from qwbmnewssss where id=26",conn,1,
Time of Update: 2018-12-08
RegExp對象提供簡單的Regex支援功能。 RegExp對象的用法: 複製代碼 代碼如下:Function RegExpTest(patrn, strng) Dim regEx, Match, Matches ' 建立變數。 Set regEx = New RegExp ' 建立Regex。 regEx.Pattern = patrn ' 設定模式。 regEx.IgnoreCase = True ' 設定是否區分字元大小寫。 regEx.Global = True ' 設定全域可用性。
Time of Update: 2018-12-08
複製代碼 代碼如下: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: 2018-12-08
ASP.NET帳號在預設情況下是沒有許可權操作Microsoft Office對象的,如果不進行許可權的配置,代碼會拋出類似以下的異常: 檢索 COM 類別工廠中 CLSID 為 {00024500-0000-0000-C000-000000000046} 的組件時失敗,原因是出現以下錯誤: 80070005。 這樣給Asp.NET操作Microsoft Office對象帶來了一定的困難。但我們還是要想辦法來進行Office對象的操作。下面簡單介紹一下本人在開發過程中曾經使用過的方法:
Time of Update: 2018-12-08
有三種主要的錯誤類型: 1.編譯錯誤: 這種錯誤出現一般都是代碼的文法問題。因為編譯錯誤而導致辭ASP停止運行。 2.運行錯誤: 這個錯誤是發生在你準備運行ASP時的。例如:如果你試圖給一個變數賦值,但是卻超出了該變數允許的範圍。 3.邏輯錯誤: 邏輯錯誤是最難被發現的,這種錯誤經常是一種結構錯誤,電腦是發現不了的。這就需要我們徹頭徹尾地檢查我們的代碼。
Time of Update: 2018-12-08
複製代碼 代碼如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %> <!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd"> <html
Time of Update: 2018-12-08
複製代碼 代碼如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=
Time of Update: 2018-12-08
首先在SQL Server中建立一個圖片儲存的數庫表,ImageData Column為圖象位元據儲存欄位,ImageContentType Column為圖象檔案類型記錄欄位,ImageDescription Column為儲蓄圖 象檔案說明欄位,ImageSize Column為儲存圖象檔案長度欄位,結構如下: 複製代碼 代碼如下:CREATE TABLE [dbo].[ImageStore] ( [ImageID] [int] IDENTITY (1, 1) NOT NULL ,
Time of Update: 2018-12-08
複製代碼 代碼如下:<% '判斷是否要產生新的HTML if Application("cache_asptohtml_date")="" then Application.Lock Application("cache_asptohtml_date")=now() Application.Unlock Call aspTohtml Response.Redirect("index.html") end if if DateDiff("s",