ajax| Data | refresh | No refresh the first thing we're going to use today is Ajax.NET Professional, you can get information about ajax.net from http://www.schwarz-interactive.de/. Second, you need to know the relevant knowledge of XML data island. Let's take a look at a simple binding example:
The first step is to first determine the XML data source
John Smith
Visual Notepad
Reference
specifies a data island
John Smith2
Visual Notepad2
Reference2
specifies a data island2
John Smith3
Visual Notepad3
Reference3
specifies a data island3
The second step is to determine the binding container, where we use the table
loading ... |
loading ... |
loading ... |
loading ... |
Take these two pieces of code copy to your HTML page to run both to see the effect.
The first segment is our XML data source, which is the data to bind, the metadata node equals the table name, AUTHOR, generator, pagetype, and abstract are equivalent to the column name, and the following table is the container for displaying the data. loading ... The
The second step is to write the code that returns the dataset:
public class MyClass
{
[Ajaxmethod]
public string GetDataSet ()
{
DataSet DST = new DataSet ();
DataTable dt = new DataTable ();
Dt. Columns.Add ("Text");
Dt. Columns.Add ("number");
Random Random = new Random (Guid.NewGuid (). GetHashCode ());
for (int i = 0; I random. Next (10,20); i++)
{
DataRow row = dt. NewRow ();
row["Text"] = Guid.NewGuid (). ToString ("N");
row["number"] = random. Next (100);
Dt. Rows.Add (row);
}
Dst. Tables.add (DT);
String text = "";
using (MemoryStream ms = new MemoryStream ())
{
Dst. WriteXml (MS);
Ms. Position = 0;
StreamReader sr = new StreamReader (MS);
Text = Sr. ReadToEnd ();
}
return text;
}
}
Step Three: Register the method in Page_Load, AjaxPro.Utility.RegisterTypeForAjax (typeof (Webtest1.ajaxtest1)) (WebTest1 is the name of the namespace)
Step Fourth: Add client Bindings
is the data source for the specified TABLE, bound field name. All right, I'll see how this can be done with Ajax to achieve no flush binding. Step One: Configure Ajax to add a configuration section to the Web.config file:
Fifth step: Edit the JavaScript code to load data
Function callback (RES)
{
if (!res.error)
{
Document.all.oDataPanel.innerHTML = ' ';
}
Else
{
alert (res.error.Message);
}
}