資源簡介
主要針對AJAX初學者,ajax+html+C#(完全手寫AJAX),將C#后置代碼從數據庫中獲取的數據顯示在HTML中。實現局部刷新。
代碼片段和文件信息
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?System.Web.UI.HtmlControls;
using?System.Data.SqlClient;
using?System.Text.Regularexpressions;
public?partial?class?_Default?:?System.Web.UI.Page
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????string?mode?=?Request.QueryString[“mode“];
????????switch?(mode)
????????{
????????????case?“getTree“:
????????????????Response.Write(getTree());
????????????????break;
????????????case?“getName“:
????????????????Response.Write(getName());
????????????????break;
????????}
????}
????//******************
????//**??獲取樹結構??**
????//******************
????public?string?getTree()
????{
??????//??string?fatherID?=?Request.QueryString[“fatherID“];
????????//if?(!IsNumber(fatherID))
????????//{
????????//????return?“yle=‘font-size:12px;?color:Black;‘>禁止提交非法的數據!“;
????????//}
????????string?StrSql?=?“Select?*?From?titles“;
???????//?SqlConnection?MyConn?=?new?SqlConnection(“Provider=Microsoft.Jet.OLEDB.4.0;?Data?Source=“?+?Server.MapPath(g_StrConn));
????????string?conn?=?“server=.;database=pubs;uid=sa;pwd=“;
????????SqlConnection?MyConn?=?new?SqlConnection(conn);
????????DataSet?ds?=?new?DataSet(“titles“);
????????MyConn.Open();
????????try
????????{
????????????SqlDataAdapter?da?=?new?SqlDataAdapter(StrSql?MyConn);
?????????????
?????????????da.Fill(ds);
????????????string?BottomStr?=?““;
????????????BottomStr?=?“yle=‘width:?100%;?height:?10px‘>“;
????????????int?count?=?ds.Tables[0].Rows.Count;
????????????for?(int?i?=?0;?i?????????????{
????????????????BottomStr?+=?““?+?ds.Tables[0].Rows[i][“title“].ToString()?+?“ “;
????????????}
????????????BottomStr?+=?“
“;
????????????MyConn.Close();
????????????return?BottomStr;
????????}
????????catch
????????{
????????????return?“yle=‘font-size:12px;?color:Black;‘>數據庫連接失敗!“;
????????}
????}
????public?string?getName()
????{
????????string?StrSql?=?“Select?*?From?titles“;
????????//?SqlConnection?MyConn?=?new?SqlConnection(“Provider=Microsoft.Jet.OLEDB.4.0;?Data?Source=“?+?Server.MapPath(g_StrConn));
????????string?conn?=?“server=.;database=pubs;uid=sa;pwd=“;
????????SqlConnection?MyConn?=?new?SqlConnection(conn);
????????DataSet?ds?=?new?DataSet(“titles“);
????????MyConn.Open();
????????try
????????{
????????????SqlDataAdapter?da?=?new?SqlDataAdapter(StrSql?MyConn);
????????????da.Fill(ds);
????????????string?BottomStr?=?““;
????????????BottomStr?=?“yle=‘width:?100%;?height:?10px‘>“;
????????????int?count?=?ds.Tables[0].Rows.Count;
????????????for?(int?i?=?0;?i?????????????{
???????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????151552??2006-10-27?11:17??MyTestAjax(絕對原創)\App_Data\data.mdb
?????目錄??????????0??2007-07-11?21:08??MyTestAjax(絕對原創)\App_Data
?????文件????????438??2007-07-11?21:00??MyTestAjax(絕對原創)\Default.aspx
?????文件???????3853??2007-07-11?20:52??MyTestAjax(絕對原創)\Default.aspx.cs
?????文件??????14430??2006-06-02?01:19??MyTestAjax(絕對原創)\Images\indicator_waitanim.gif
?????文件???????2209??2006-09-09?13:18??MyTestAjax(絕對原創)\Images\loading.gif
?????文件???????1975??2006-06-02?01:19??MyTestAjax(絕對原創)\Images\progressbar_long_green.gif
????..A.SH.?????10752??2007-07-11?21:06??MyTestAjax(絕對原創)\Images\Thumbs.db
?????目錄??????????0??2007-07-11?21:08??MyTestAjax(絕對原創)\Images
?????文件???????2593??2007-07-12?01:30??MyTestAjax(絕對原創)\js\Ajax.js
?????目錄??????????0??2007-07-12?01:30??MyTestAjax(絕對原創)\js
?????文件???????1031??2007-07-12?00:41??MyTestAjax(絕對原創)\MyAjax.html
?????文件???????1622??2006-09-14?18:42??MyTestAjax(絕對原創)\Web.Config
?????目錄??????????0??2007-07-12?01:30??MyTestAjax(絕對原創)
-----------?---------??----------?-----??----
???????????????190455????????????????????14
評論
共有 條評論
相關資源
-
HTML5 CSS3 :canvas 模擬實現電子彩票刮
-
仿Win10 UI界面(前端html模板)
-
永劫無間主題 html+css
-
登錄html
-
游戲商城html模板(首頁)
-
生日祝福html代碼(帶背景音樂)
-
基礎html小米商城
-
W3C html5 參考手冊(教學資源免費)
-
html5 2048小游戲
-
oa html模板(基于Vue開發)
-
個人網站備案的HTML模板
-
html旅游靜態網站
-
簡易京東網頁HTML代碼(HTMLamp;JS;)
-
有問必答項目 html源碼
-
html 塔防游戲runner
-
html 二十一點
-
生日祝福html網頁源碼(特效很多)
-
時時彩網站 html模板(手機端 )
-
HTML可視化面板
-
印象烘培 首頁html源碼
-
H5彩票網站html代碼
-
教育類網站html代碼
-
人才招聘資訊博客HTML模板手機版自適
-
新浪手機新聞網站模板首頁html源碼
-
個人博客html代碼
-
強大的后端系統模板HTML5后臺頁面(
-
旅游網站html代碼
-
黑色個人博客HTML5模板(如影隨形)
-
后臺管理系統html模板(H-ui.adminv3.1)
-
html 捕魚達人