<%@ Page Language="C#" AutoEventWireup="true" CodeFile="View.aspx.cs" Inherits="View" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function CallServer()
{
var product = "DFDF";
<%= ClientScript.GetCallbackEventReference(this, "product", "ReceiveServerData",null)%>;
}
function ReceiveServerData(Value)
{
document.all.oDataPanel.innerHTML = '<xml id="xmlData">'+ Value +'</xml>';
}
</script>
</head>
<body>
<input id="Button1" onclick="CallServer()" type="button" value="Call to Server" />
sfd
<form id="form1" runat="server">
<div>
<table width="400" border="0" cellpadding="0" cellspacing="1" DATAPAGESIZE="20" bgcolor="#CCCCCC" id="datatable" datasrc="#xmlData">
<tr>
<td bgcolor="#FFFFFF" style=" font-size:12px"><span datafld="id"></span></td>
<td bgcolor="#FFFFFF" style=" font-size:12px"><span datafld="djh"></span></td>
<td bgcolor="#FFFFFF" style=" font-size:12px"><span datafld="rq"></span></td>
</tr>
</table>
</div>
<div id="oDataPanel">
</div>
</form>
</body>
</html>View.aspx
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;
public partial class View : System.Web.UI.Page, ICallbackEventHandler
{
private string CallBackValue = string.Empty;
ClassData MyClass = new ClassData();
protected void Page_Load(object sender, EventArgs e)
{
}
string ICallbackEventHandler.GetCallbackResult()
{
DataSet _DS = MyClass.ExecDs("select top 10 from table ", "table ");
return _DS.GetXml();
}
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
this.CallBackValue = eventArgument;
}
}
View.cs


浙公网安备 33010602011771号