CS页面:
1
using System;
2
using System.Collections;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Web;
7
using System.Web.SessionState;
8
using System.Web.UI;
9
using System.Web.UI.WebControls;
10
using System.Web.UI.HtmlControls;
11
using System.Text;
12
using System.Data.OracleClient;
13
using System.IO;
14![](/Images/OutliningIndicators/None.gif)
15
namespace Sun.ComponentArts
16
{
17
/// <summary>
18
/// AJAX1 の概要の説明です。
19
/// </summary>
20
public class AJAX1 : System.Web.UI.Page
21
{
22
23
private void Page_Load(object sender, System.EventArgs e)
24
{
25
Ajax.Utility.RegisterTypeForAjax(typeof(AJAX1));
26
}
27![](/Images/OutliningIndicators/InBlock.gif)
28
[Ajax.AjaxMethod()]
29
public int ServerSideAdd(int firstNumber, int secondNumber)
30
{
31
return firstNumber + secondNumber;
32
}
33
34![](/Images/OutliningIndicators/InBlock.gif)
35
[Ajax.AjaxMethod]
36
public string buildGrid(int startRecord)
37
{
38
StringBuilder strb = new StringBuilder();
39
try
40
{
41
OracleConnection dbCon = new OracleConnection("Data Source=mic; User ID=claimWork; Password=bitoc");
42
dbCon.Open();
43
44
string sql = "select t.payment_num, t.billed_num, t.cust_num, t.entry_timestamp from t_payment t order by t.payment_num";
45
OracleDataAdapter dbAdapter = new OracleDataAdapter(sql, dbCon);
46
DataSet ds = new DataSet();
47
dbAdapter.Fill(ds, startRecord, 15, "Table1");
48
49
DataGrid dg = new DataGrid();
50
dg.DataSource = ds.Tables["Table1"];
51
dg.DataBind();
52
53
strb = new StringBuilder();
54
55
StringWriter sw = new StringWriter(strb);
56
57
HtmlTextWriter writer = new HtmlTextWriter(sw);
58
dg.RenderControl(writer);
59![](/Images/OutliningIndicators/InBlock.gif)
60
return strb.ToString();
61
}
62
catch(Exception ex)
63
{
64
return strb.ToString();
65
}
66
}
67![](/Images/OutliningIndicators/InBlock.gif)
68
Web フォーム デザイナで生成されたコード
88![](/Images/OutliningIndicators/InBlock.gif)
89![](/Images/OutliningIndicators/InBlock.gif)
90![](/Images/OutliningIndicators/InBlock.gif)
91![](/Images/OutliningIndicators/InBlock.gif)
92
}
93
}
94![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/None.gif)
15
![](/Images/OutliningIndicators/None.gif)
16
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
17
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
18
![](/Images/OutliningIndicators/InBlock.gif)
19
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/InBlock.gif)
24
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
25
![](/Images/OutliningIndicators/InBlock.gif)
26
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
27
![](/Images/OutliningIndicators/InBlock.gif)
28
![](/Images/OutliningIndicators/InBlock.gif)
29
![](/Images/OutliningIndicators/InBlock.gif)
30
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
31
![](/Images/OutliningIndicators/InBlock.gif)
32
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
33
![](/Images/OutliningIndicators/InBlock.gif)
34
![](/Images/OutliningIndicators/InBlock.gif)
35
![](/Images/OutliningIndicators/InBlock.gif)
36
![](/Images/OutliningIndicators/InBlock.gif)
37
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
38
![](/Images/OutliningIndicators/InBlock.gif)
39
![](/Images/OutliningIndicators/InBlock.gif)
40
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
41
![](/Images/OutliningIndicators/InBlock.gif)
42
![](/Images/OutliningIndicators/InBlock.gif)
43
![](/Images/OutliningIndicators/InBlock.gif)
44
![](/Images/OutliningIndicators/InBlock.gif)
45
![](/Images/OutliningIndicators/InBlock.gif)
46
![](/Images/OutliningIndicators/InBlock.gif)
47
![](/Images/OutliningIndicators/InBlock.gif)
48
![](/Images/OutliningIndicators/InBlock.gif)
49
![](/Images/OutliningIndicators/InBlock.gif)
50
![](/Images/OutliningIndicators/InBlock.gif)
51
![](/Images/OutliningIndicators/InBlock.gif)
52
![](/Images/OutliningIndicators/InBlock.gif)
53
![](/Images/OutliningIndicators/InBlock.gif)
54
![](/Images/OutliningIndicators/InBlock.gif)
55
![](/Images/OutliningIndicators/InBlock.gif)
56
![](/Images/OutliningIndicators/InBlock.gif)
57
![](/Images/OutliningIndicators/InBlock.gif)
58
![](/Images/OutliningIndicators/InBlock.gif)
59
![](/Images/OutliningIndicators/InBlock.gif)
60
![](/Images/OutliningIndicators/InBlock.gif)
61
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
62
![](/Images/OutliningIndicators/InBlock.gif)
63
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
64
![](/Images/OutliningIndicators/InBlock.gif)
65
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
66
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
67
![](/Images/OutliningIndicators/InBlock.gif)
68
![](/Images/OutliningIndicators/ContractedSubBlock.gif)
88
![](/Images/OutliningIndicators/InBlock.gif)
89
![](/Images/OutliningIndicators/InBlock.gif)
90
![](/Images/OutliningIndicators/InBlock.gif)
91
![](/Images/OutliningIndicators/InBlock.gif)
92
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
93
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
94
![](/Images/OutliningIndicators/None.gif)
HTML页面:
<%@ Page language="c#" Codebehind="AJAX1.aspx.cs" AutoEventWireup="false" Inherits="Sun.ComponentArts.AJAX1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>AJAX1</title>
<script language="javascript">
var iCount = 0;
function NextMove()
{
iCount = iCount + 10;
AJAX1.buildGrid(iCount, buildGrid_CallBack);
}
function PreviousMove()
{
if(iCount > 0)
{
iCount = iCount - 10;
AJAX1.buildGrid(iCount, buildGrid_CallBack);
}
}
function buildGrid_CallBack(response){
var cc=document.all("table1");
cc.innerHTML = response.value;
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table>
<tr>
<td><input type="button" id="btnDisplay" name="btnDisplay" value="CallBackDisplay" onclick="AJAX1.buildGrid(0, buildGrid_CallBack);"></td>
</tr>
<tr>
<td><div id="table1" name="table1"></div></td>
</tr>
<tr>
<td>
<input type="button" id="btnPrevious" name="btnPrevious" value="Previous" onclick="PreviousMove();">
<input type="button" id="btnNext" name="btnNext" value="Next" onclick="NextMove();">
</td>
</tr>
</table>
</form>
</body>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>AJAX1</title>
<script language="javascript">
var iCount = 0;
function NextMove()
{
iCount = iCount + 10;
AJAX1.buildGrid(iCount, buildGrid_CallBack);
}
function PreviousMove()
{
if(iCount > 0)
{
iCount = iCount - 10;
AJAX1.buildGrid(iCount, buildGrid_CallBack);
}
}
function buildGrid_CallBack(response){
var cc=document.all("table1");
cc.innerHTML = response.value;
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table>
<tr>
<td><input type="button" id="btnDisplay" name="btnDisplay" value="CallBackDisplay" onclick="AJAX1.buildGrid(0, buildGrid_CallBack);"></td>
</tr>
<tr>
<td><div id="table1" name="table1"></div></td>
</tr>
<tr>
<td>
<input type="button" id="btnPrevious" name="btnPrevious" value="Previous" onclick="PreviousMove();">
<input type="button" id="btnNext" name="btnNext" value="Next" onclick="NextMove();">
</td>
</tr>
</table>
</form>
</body>
</HTML>