- 2010-03-21
在搜索關鍵詞高亮中一般的方法都是采用替換的辦法(Replace)這個方法有一個缺點就是不能區分大小寫的問題。在網上找了找發現有人用正則表達式的方法來解決這個問題還真不錯,效率也比較高,歸納如下,有用得到的朋友可以一試。 //搜索關鍵詞高亮顯示函數 pu
- 2010-03-18
aspx設計頁面 //這個是檢測按鈕,檢測下面的checkbox是否被選中。選中時打印其值 asp:ButtonID=Button1runat=serverText=檢測OnClick=Button1_Click/ 第一種設計:(.net自帶的) asp:CheckBoxID=CheckBox1runat=serverText=報紙/ asp:CheckBoxID
- 2010-03-17
在網上看到,很多朋友在asp.net中做urlrewrite,用的是HttpHandle+Server.Transfer的方法。其實這種方法是錯誤的。 第一,HttpHandle是實現不了urlrewrite的; 第二Server.Transfer是標準的重定向,根本不是urlrewrite。 其實,實現urlrewrite不用自己HttpHan
- 2010-03-16
asp:TemplateField HeaderTemplate其他要求/HeaderTemplate ItemTemplate ahref=news22.aspx?id=%#Eval(id)%target=_blank%#Eval(Message).ToString().Length7?Eval(Message).ToString().Substring(0,7)+...:Eval(Message).ToString()%/a /Item
- 2010-03-15
privateDataTableCreateTable() { DataTabledt=newDataTable(dirName); #regiontablecolumn DataColumncolumnID=newDataColumn();//創建一列 columnID.DataType=System.Type.GetType(System.Int32);//數據類型 columnID.ColumnName=ID;//列名 columnID.
- 2010-03-14
?xmlversion=1.0standalone=yes? configurationxmlns=http://schemas.microsoft.com/.NetConfiguration/v2.0 !--配置全局變量-- appSettings addkey=examstrvalue=server=.;database=myweb_exam_db;uid=exam_login;pwd=xxd_examadmin/ /appSettings
- 2010-03-11
具體實現如下: 1. OBJECTid=WebBrowserclassid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2height=0width=0 /OBJECT pinputtype=buttonvalue=打印預覽onclick=document.all.WebBrowser.ExecWB(7,1);//p 將以上代碼貼入aspx文件中,點擊”打印
- 2010-03-10
protectedvoidReadFile()// 讀取文件夾,文件 { stringsavePath=@common; StringBuilderoutstring=newStringBuilder(); stringabsSavePath=Server.MapPath(savePath); string[]Directorys=Directory.GetDirectories(absSavePath+@/+Page.User.Identity.Na
- 2010-03-09
使用的方法是: publicboolIsUrl() { stringstr1=System.Web.HttpContext.Current.Request.ServerVariables[HTTP_REFERER]; stringstr2=System.Web.HttpContext.Current.Request.ServerVariables[SERVER_NAME]; return((str1!=null)(str1.IndexOf(str2)==7
- 2010-03-08
% #Bind( Subject ) % //綁定字段 % #Container.DataItemIndex + 1 % //實現自動編號 % #DataBinder.Eval(Container.DataItem, [n] ) % 通常使用的方法 % #DataBinder.Eval(Container.DataItem, ColumnName ) % % #DataBinder.Eval(Container.Da
- 2010-03-05
一、什么是SQL注入式攻擊? 所謂SQL注入式攻擊,就是攻擊者把SQL命令插入到Web表單的輸入域或頁面請求的查詢字符串,欺騙服務器執行惡意的SQL命令。在某些表單中,用戶輸入的內容直接用來構造(或者影響)動態SQL命令,或作為存儲過程的輸入參數,這類表單特別
- 2010-02-28
ASP.Net控件模板中根據綁定對象的屬性控制元素隱現技巧 在ASP.Net頁面中,控制部分元素隱現通常采用這種方法: %if(this.顯示編輯面板){% ……要顯示的Html代碼…… %}% 這種用法很方便,但是如果希望在服務器控件模板中使用它,以對綁定對象的某個屬性進行
- 2010-02-27
1.default.aspx設計頁面 %@PageLanguage=C#AutoEventWireup=trueCodeFile=Default.aspx.csInherits=_Default% EhtmlPUBLIC-//W3C//DTDXHTML1.0xhtml1-transitional.dtd htmlxmlns=http
- 2010-02-26
訪問發布在本機IIS上的站點時,老彈出一個框要求輸入用戶名密碼,而輸入本機的管理員帳戶,卻還是彈出這個框來。這個問題非常煩,網上的意見如下: 1.設置發布目錄文件夾的訪問權限,允許everyone訪問。 2.設置IIS安全選項卡中,允許匿名訪問。 這里漏過了一
- 2010-02-26
設計模版: 頁眉 HeaderTemplate /HeaderTemplate 頁腳 FooterTemplate /FooterTemplate 數據記錄 ItemTemplate /ItemTemplate AlternatingItemTemplate交替顯示項 /AlternatingItemTemplate SelectedItemTemplate選中時的顯示方式 /SelectedItemTemplate Ed
- 2010-02-26
首先新建一個名為article.aspx的文件,將以下內容拷貝到article.aspx.cs中: usingSystem; usingSystem.Data; usingSystem.Configuration; usingSystem.Collections; usingSystem.Web; usingSystem.Web.Security; usingSystem.Web.UI; usingSystem.Web.UI.WebCo
- 2010-02-25
privatevoidbtnMIME_Click(objectsender,System.EventArgse) { BindData(); Response.ContentType=application/vnd.ms-Excel; Response.AddHeader(Content-Disposition,inline;filename= +HttpUtility.UrlEncode(下載文件.xls,Encoding.UTF8)); //如
- 2010-02-25
asp:CheckBoxListID=cblJLrunat=serverRepeatDirection=HorizontalWidth=100% asp:ListItem當前記錄asp:ListItem asp:ListItem當前頁asp:ListItem asp:ListItem全部記錄asp:ListItem /asp:CheckBoxList 后臺3種方式: 第一種:獲得CheckBox的值 C#代
- 2010-02-23
// 返回多個值函數 privatestringTestOut(outchari) { i=’a’; returngoodstudy; } protectedvoidPage_Load(objectsender,EventArgse) { chari;//不必初始化 stringgetReturn=TestOut(outi); Response.Write(方法執行的返回值是:+getReturn+\r\n); Res
- 2010-02-16
publicstaticvoidSetDefEnterControl(System.Web.UI.ControlCtrl) { PagemPage=Ctrl.Page; stringmScript; mScript=@scriptlanguage=javascript; mScript=mScript+functiondocument.onkeydown(){; mScript=mScript+vare=event.srcElement;; mScript