Time of Update: 2018-12-08
寫一個方法: 複製代碼 代碼如下:private void DisplayAllControl(Control control, int step) { foreach (Control ctl in control.Controls) { string s = new string('-', step * 4) + ctl.GetType().Name + "〈" + ctl.ID + "〉"; Response.Write(s + "<br/>"); if
Time of Update: 2018-12-08
通過下面的代碼可以實現這種切換的效果。 首先我們來看介面: 介面代碼: 複製代碼 代碼如下:<body> <form id="form1" runat="server"> <div align="center"> <fieldset style="width: 400px; height: 200px;"> <table cellpadding="3" cellspacing="3" border="0"> <tr>
Time of Update: 2018-12-08
在前段時間的開發網站的過程中,突然覺得這個簡潔的樣式看著和網站整體的風格實在不搭調,於是看看AspNetPager的最後產生html,寫了一段CSS樣式,將分頁的樣式和網站整體風格統一起來了。效果如下:做的不是很好看,希望大家不要丟磚頭,俺的頭沒包棉絮,傷不起 ~—_—~CSS樣式表:/* AspNetPager Style Power By http://www.edweb.cn */.pager{ width:95%; margin:10px; line-height:20px;
Time of Update: 2018-12-08
複製代碼 代碼如下:using System.Data; using System.Diagnostics; using System.Data.SqlClient; string connectionString = "Data Source=HG-J3EJJ9LSW5PY;Initial Catalog=Test;User ID=sa;password=hg"; DataTable dataTable = sql_.select_datagrid(" select a from
Time of Update: 2018-12-08
在ASP.NET 中有很多資料展現的控制項,比如用的最多的GridView,它同時也內建了分頁的功能。但是我們知道用GridView來顯示資料,如果沒有禁用ViewState,頁面的大小會是非常的大的。而且平時我們點擊首頁,下一頁,上一頁,尾頁這些功能都是會引起頁面回傳的,也就是需要完全跟伺服器進行互動,來迴響應的時間,傳輸的資料量都是很大的。AJAX的分頁可以很好的解決這些問題。 開發的壞境是:jQuery AJAX+Northwind。 具體的步驟: SearchCustomer.aspx:
Time of Update: 2018-12-08
string fox; fox.ToLower()轉化成小寫字母 fox.ToUpper()轉化成大寫字母 fox.Trim()刪除前後空格 fox.Trim(trimChars)刪除其它字元 fox.TrimStart()刪除前空格 fox.TrimEnd()刪除後空格 fox.PadLeft(10)增加左邊空格,使字串達到某長度。 fox.PadRight(10)增加右邊空格,使字串達到某長度。 fox.PadX(10,'-')增加其它字元,使字串達到某長度。X指:Left/Right
Time of Update: 2018-12-08
1、Linux主機重新導向 Godaddy的Liunx主機,Godaddy本身已經支援Apache,所以直接建立一個.htaccess檔案就可以了,一般來說,在本地無法建立.htaccess的時候可以先建立一個txt格式檔案,上傳到根目錄的時候再重新命名為".htaccess"就可以了。網上很多如何進行 301重新導向的教程,無論是整站重新導向還是單頁重新導向。下面就以我的www.jb51.net為例 1.1 無www網域名稱轉移到www網域名稱 複製代碼 代碼如下:RewriteEngine
Time of Update: 2018-12-08
一下是這個代碼: 只允許 使用者名稱輸入:使用者名稱稱的開頭,必須為0~9、a~z或A~Z ! 複製代碼 代碼如下:protected void Button3_Click(object sender, EventArgs e) { int error_count = 0; //用於識別使用者名稱的合法性 string str = TextBox1.Text.Trim(); if (str == string.Empty) { Response.Write("使用者名稱稱不可為空!");
Time of Update: 2018-12-08
其中的兩個方法可以輕鬆的實現各種進位的數值間的轉換: Convert.ToInt32(string value, int fromBase): 可以把不同進位數值的字串轉換為數字,其中fromBase參數為進位的格式,只能是2、8、10及16: 如Convert.ToInt32(”0010”,2)執行的結果為2; Convert.ToString(int value, int toBase): 可以把一個數字轉換為不同進位數值的字串格式,其中toBase參數為進位的格式,只能是2、8、10及16
Time of Update: 2018-12-08
代碼如下: 複製代碼 代碼如下:<% '用ASP擷取遠程目標網頁指定內容,代碼由廣州網站建設http://www.jb51.net提供 On Error Resume Next Server.ScriptTimeOut=9999999 Function getHTTPPage(Path) t = GetBody(Path) getHTTPPage=BytesToBstr(t,"GB2312") End function Function Newstring(wstr,strng)
Time of Update: 2018-12-08
複製代碼 代碼如下:// 涉及命名空間 using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Web; using
Time of Update: 2018-12-08
前段時間看到園裡有位高手寫了個純css+js的一個效果,我把它和asp.net驗證控制項結合起來,用這位高手寫的效果做為asp.net難控制項的提示效果。如 和以前寫的比這次寫的使用起來方便,只要每個頁面繼承BasePage就可以了,其中Validator檔案夾是必需的檔案夾。 代碼 複製代碼 代碼如下:namespace ValidatorTest { public partial class Default : <SPAN style="COLOR:
Time of Update: 2018-12-08
複製代碼 代碼如下:#region IHttpHandler 成員 bool IHttpHandler.IsReusable { get { return true; } } void IHttpHandler.ProcessRequest(HttpContext context) { string FileName = context.Server.MapPath(context.Request.FilePath); if (context.Request.UrlReferrer.Host =
Time of Update: 2018-12-08
在實際項目開發中,我找到了一種利用GridView實現分級效果的方法,最終如下: 以下是實現代碼: Aspx頁面 複製代碼 代碼如下:<asp:GridView ID="GridView1" SkinID="GridView" runat="server" AutoGenerateColumns="false" Width="100%" AllowPaging="true" PageSize="10"> <Columns> <asp:TemplateField
Time of Update: 2018-12-08
所以對應的asp處理代碼如下複製代碼 代碼如下:dedearr=split(xiangguanid2,chr(13)) '分割成數組for dede=0 to ubound(dedearr)-1 '數組長度減一,因為最後有兩個chr(13)換行。dedearr2=split(dedearr(dede),"|") dedetitle=dedearr2(1) dedeurl=dedearr2(0) if dedetitle<>"" and dedeurl<>"" then
Time of Update: 2018-12-08
複製代碼 代碼如下:DataTable dt = new DataTable(); dt = ds.Tables["All"].Clone();//複製All的結構傳遞給dt DataRow[] dr=this.dataSet31.Tables["Product"].Select("bc=1"); //通過條件得到合格行 for(int i=0;i<dr.Length;i++) { //將數組元素加入表... dt.Rows.Add(dr[i]);//出錯提示為:該行已經屬於另一個表 }
Time of Update: 2018-12-08
複製代碼 代碼如下:StreamReader sr = new StreamReader("E:\\123.txt");//檔案路徑 string oneLine; while ((oneLine = sr.ReadLine()) != null) { string[] str = oneLine.Split('|'); string sql = "insert into TableDX(number,name,produce,xinghao) values('" +
Time of Update: 2018-12-08
第一種方法:這個是刪除單欄位圖片的代碼。比較簡單,因為圖片欄位已經預先存在資料庫表的bookpic的欄位裡面了。 複製代碼 代碼如下:<!--#include file="conn.asp"--> <% fileid=trim(request("fileid"))'要刪除的記錄ID set rs=server.createobject("adodb.recordset") sql="select * from shop_books where bookid=3090"
Time of Update: 2018-12-08
複製代碼 代碼如下:<% dim fso,objFolder,objFiles dim filelist Set fso=Server.CreateObject("scripting.FileSystemObject") Set objFolder=fso.GetFolder(server.MapPath("thumbs")) Set objFiles=objFolder.Files '迴圈輸出檔案夾path下的檔案的檔案名稱 For each objFile in objFiles
Time of Update: 2018-12-08
Chrome提示:確定相關JS已經包含在頁面中,(用的是MasterPage,二個頁麵包含的js檔案完全相同),排除了js引用路徑不正確的問題。頁面上產生的mvcClientValidationMetadata也沒問題,但用戶端驗證就是不起作用。將MicrosoftAjax.js替換成MicrosoftAjax.debug.js。在Chrome調試工具中看到此異常在Sys.UI.DomElement.getElementById函數中拋出在394行加個斷點,重新整理頁面,一步步跟蹤,162行,根