Time of Update: 2018-12-08
上篇文章我們用字串尋找的方法實現了asp email郵箱地址的驗證,有可能比較喜歡Regex的朋友,這裡也給出相應的代碼。方法一 複製代碼 代碼如下:Public Function ChkMail(ByVal Email) Dim Rep,Pmail : ChkMail = True : Set Rep = New RegExp Rep.Pattern = "([.a-zA-Z0-9_-]){2,10}@([a-zA-Z0-9_-]){2,10}(.([a-zA-Z0-9]){2,}){1,4}
Time of Update: 2018-12-08
1。 testlist.aspx頁面: 複製代碼 代碼如下:<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <link rel="stylesheet" href="jscript/autoSuggest.css" type="text/css"/> <link rel="stylesheet"
Time of Update: 2018-12-08
服務端部分 ,文字檔分頁的類。主要在流中處理。當然我看過網上的用</br> 關鍵字進行分頁的 個人覺得不是所有時候都能滿足要求,所一自己寫了這個,還是費了點時間,主要在於本人太笨,基礎很差。希望大家個出更好的建議 複製代碼 代碼如下:using System; using System.Collections.Generic; using System.Text; using System.IO; namespace Txt { public class TxtPager {
Time of Update: 2018-12-08
一、通過命令源擷取當前行索引。 方法比較多, GridView 的 Command 事件中無法象 DataGrid 那樣直接擷取行, 法1, GridViewRow drv = ((GridViewRow)(((Button)(e.CommandSource)).Parent.Parent));//CommandSource 引起事件的命令源,(疑問,根據MSDN說的是GridView,如果這樣的話這樣操作是錯誤的,但我得到的確實正確的,那說明得到的是BUtton控制項,等待以後查證).
Time of Update: 2018-12-08
1、簡述 ID是設計的時候自己所指定的ID,是我們分配給伺服器控制項的程式設計識別碼,我們常常使用this.controlid來尋找控制項,那麼這個controlid就是這裡所說的ID. ClientID是由ASP.Net產生的伺服器控制項得用戶端標識符,當這個控制項產生到用戶端頁面的時候,在用戶端代碼訪問該控制項時就需要通過ClientID來訪問。 UniqueID 伺服器控制項的唯一的、分層的形式限定的標識符。 是當需要參與服務端回傳的時候用的。當將控制項放置到重複控制項(Repeater、
Time of Update: 2018-12-08
貼出來控制項頁面的代碼. PicList.ascx 複製代碼 代碼如下:<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PicList.ascx.cs" Inherits="WebParts_PicList" %> <style type="text/css"> /* Reset style */ * { margin: 0; padding: 0; word-break: break-all; }
Time of Update: 2018-12-08
成員關係的概念在人類社會中是一個層次比較低的概念,源於希望屬於某個群組的意識。我們希望能覺得自己是某個團隊的一部分,讓別人知道我們是誰,因此Web搭上這個流行趨勢,採用這個概念只是時間早晚的問題。如果坐下來想一想曾經登入過多少個網站並在這些網站上儲存了簡單的使用者資訊,可能會發現自己所屬的群組比一開始想象的要多得多。從出售書籍和小器具的網站到討論擁有一輛Ford Puma的好處的社區,或者宣傳一個名為Look Around You的BBC
Time of Update: 2018-12-08
在Google上搜一下,可以發現一大堆對ASP不好的評價,什麼運行速度慢、異常處理機制不好、缺乏物件導向機制、開發效率低、漏洞多等等。為了讓大家對ASP有個正確的認識,我先為它正名。一、ASP不慢,慢的是資料庫幾年前,我用動網論壇程式架了一個BBS,這套程式就是當時經典的ASP+Access架構。我也遇到了某些人所說的論壇慢,有時候卡死不動的問題。然而,自從我換上SQL
Time of Update: 2018-12-08
閑暇時重新再看之前很多項目代碼的時候,發現很多總是有那麼點缺陷的代碼,如芒刺入骨,令人心煩。掙紮良久,苦口婆心勸薦自己今後要爭取把某些代碼寫的更易用更靈活更完善一些。比如在這篇已經提及到的通用用戶端分頁顯示輔助類(AspNetPager),在大大小小項目中出現頻率非常高,但是顯然對分頁形式的選擇和樣式的控制弱了點。雖然之前這個功能的實現都是按照實際項目的需求來實現的,對舊項目沒有影響,但是這也不能成為該功能沒有充分實現擴充性和通用性的理由,這點向來自傲的樓豬也不得不承認。
Time of Update: 2018-12-08
1. 頁面 在onclick事件中 "傳自己" 複製代碼 代碼如下:<asp:TemplateField HeaderText="全選"> <HeaderTemplate> <input type="checkbox" id="CheckBox1" name="CheckBox1" onclick="GetAllCheckBox(this)" /> 全選 </HeaderTemplate> <ItemTemplate> <asp:
Time of Update: 2018-12-08
直接上代碼: 複製代碼 代碼如下:using System; using System.Collections.Generic; using System.Text; using System.Reflection; using System.IO; using System.Net; using System.Xml; namespace Update { /// <summary> /// 更新完成觸發的事件 /// </summary>
Time of Update: 2018-12-08
一、AspNetPager分頁控制項 分頁是Web應用程式中最常用到的功能之一,在ASP.NET中,雖然內建了一個可以分頁的DataGrid(asp.net 1.1)和GridView(asp.net 2.0)控制項,但其分頁功能並不盡如人意,如可定製性差、無法通過Url實現分頁功能等,而且有時候我們需要對DataList和Repeater甚至自訂資料繫結控制項進行分頁,手工編寫分頁代碼不但技術難度大、任務繁瑣而且代碼重用率極低,因此分頁已成為許多ASP.NET程式員最頭疼的問題之一。
Time of Update: 2018-12-08
有兩種方法: 第一種方法:重載架構類的Create函數,具體代碼如下: 複製代碼 代碼如下:BOOL CMainFrame::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle , const RECT& rect , CWnd* pParentWnd , LPCTSTR lpszMenuName , DWORD dwExStyle , CCreateContext* pContext) { //
Time of Update: 2018-12-08
代碼如下:複製代碼 代碼如下:string start = Request.Form.Get("date2").ToString(); //擷取開始日期,此控制項為html控制項 string end = Request.Form.Get("date3").ToString(); //擷取結束日期,此控制項為html控制項 string[] start_date = start.Split('-'); //分離出開始日期的年、月、日 string[] end_date = end.Split('
Time of Update: 2018-12-08
複製代碼 代碼如下:<% set studentinstance = CreateStudent() if not isnull(studentinstance) then Response.write("StudentId:"&studentinstance.StudentId&"<Br/>") Response.write("StudentName:"&studentinstance.StudentName&"<Br/>")
Time of Update: 2018-12-08
就是希望讓Web應用程式從一開始運行到結束都一直存在,有人就說為什麼不用Application呢?其實Cache是可以一段時間內自動更新資料的,而Application就無法做成這樣的,另外Application在Web這種高並發的系統中一定要考慮安全執行緒的問題,Application本身就不是安全執行緒的,而Cache就是安全執行緒。所以一般我都會在很多個物件中我只從Web開始啟動並執行時候從資料庫或檔案裡擷取一次資料,在不同的頁面中,都是使用Cache的,而且Cache中的資料可能弄成自動
Time of Update: 2018-12-08
核心技術: 複製代碼 代碼如下:using System.Data.SqlClient; using System.IO; string SqlStr1 = "Server=(local);DataBase=master;Uid=sa;Pwd="; string SqlStr2 = "Exec sp_helpdb"; string SqlStr1 = "Server=(local);database='" + this.DropDownList1.SelectedValue +
Time of Update: 2018-12-08
我還是直接貼例子在說明一下吧: 複製代碼 代碼如下://Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using EncodeMy; namespace TestEnCode { public
Time of Update: 2018-12-08
個人喜歡用Repeater,因其簡潔,此AjaxPager定向為Repeater! 一步一步看來: 代碼 複製代碼 代碼如下:[DefaultProperty("TotalRecord"), ToolboxData("<{0}:AjaxPager runat=server></{0}:AjaxPager>")] public class AjaxPager : WebControl,ICallbackEventHandler { public AjaxPager() :
Time of Update: 2018-12-08
第一種:利用用戶端控制項實現 JS: 複製代碼 代碼如下:<script type="text/javascript"> function checkAll() { var checklist=document.getElementsByTagName("input"); for(var i=0;i<checklist.length;i++) { if(checklist[i].type=="checkbox") { checklist[i].checked=document.