我绑定的数据能显示表格,但是数据都显示不出来。以下是我的代码,请大家看看有什么问题? protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(getdt));
}
} [AjaxPro.AjaxMethod]
public static DataTable SelectTemType()
{
IDBOperator idbo = Common.GetIDBOperator();
DataTable dt = idbo.ExecuteDataset2("select id,name from tem");
return dt;
} function getddaa()
{
var ds =getdt.SelectTemType().value;
if(ds != null && typeof(ds) == "object")
{
var s = new Array();
s[s.length] = "<table style='border: #000000 1px solid; color: #993333; font-family: 'Microsoft Sans Serif'; background-color: #ffff99;'>";
s[s.length] ="<tr style='background-color:Blue'>"
s[s.length] ="<td>" + "id" + "</td>";
s[s.length] ="<td>" + "name" + "</td>";
s[s.length] ="</tr>"
for(var i=0; i<ds.Rows.length; i++)
{
s[s.length] = "<tr>";
s[s.length] = "<td>" + ds.Rows[i]["id"] + "</td>";
s[s.length] = "<td>" + ds.Rows[i]["name"] + "</td>";
s[s.length] = "</tr>";
}
s[s.length] = "</table>";
document.getElementById("div1").innerHTML = s.join("");
}
else
{
alert("调用Ajax接口函数错误!");
}
}
{
if (!IsPostBack)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(getdt));
}
} [AjaxPro.AjaxMethod]
public static DataTable SelectTemType()
{
IDBOperator idbo = Common.GetIDBOperator();
DataTable dt = idbo.ExecuteDataset2("select id,name from tem");
return dt;
} function getddaa()
{
var ds =getdt.SelectTemType().value;
if(ds != null && typeof(ds) == "object")
{
var s = new Array();
s[s.length] = "<table style='border: #000000 1px solid; color: #993333; font-family: 'Microsoft Sans Serif'; background-color: #ffff99;'>";
s[s.length] ="<tr style='background-color:Blue'>"
s[s.length] ="<td>" + "id" + "</td>";
s[s.length] ="<td>" + "name" + "</td>";
s[s.length] ="</tr>"
for(var i=0; i<ds.Rows.length; i++)
{
s[s.length] = "<tr>";
s[s.length] = "<td>" + ds.Rows[i]["id"] + "</td>";
s[s.length] = "<td>" + ds.Rows[i]["name"] + "</td>";
s[s.length] = "</tr>";
}
s[s.length] = "</table>";
document.getElementById("div1").innerHTML = s.join("");
}
else
{
alert("调用Ajax接口函数错误!");
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货