大侠们:
AjaxPro在.net2005已经换成支持net2.0的版本,运行ch51.Tree.GetSubCategory(iCategoryID, GetSubCategory_callback);调试过程中没进入断点,但在.net2003顺利通过,这是怎么回事?
前台javaScript脚本:
function ExpandSubCategory(iCategoryID)
{
var li_father = document.getElementById("li_" + iCategoryID);
if (li_father.getElementsByTagName("li").length > 0) //分类已下载
{
ChangeStatus(iCategoryID);
displayDocList(iCategoryID);
return;
}
li_father.className = "Opened";
switchNote(iCategoryID, true);
ch51.Tree.GetSubCategory(iCategoryID, GetSubCategory_callback);
}
//*************************************************
function GetSubCategory_callback(response)
{
var dt = response.value.Tables[0];
if (dt.Rows.length > 0)
{
var iCategoryID = dt.Rows[0].FatherID;
}
var li_father = document.getElementById("li_" + iCategoryID);
var ul = document.createElement("ul");
for (var i = 0;i < dt.Rows.length;i++)
{
if (dt.Rows[i].IsChild == 1) //叶子节点
{
var li = document.createElement("li");
li.className = "Child";
li.id = "li_" + dt.Rows[i].CategoryID;
var img = document.createElement("img");
img.id = dt.Rows[i].CategoryID;
img.className = "s";
img.src = "css/s.gif";
var a = document.createElement("a");
a.href = "javascript:OpenDocument('" + dt.Rows[i].CategoryID + "');";
a.innerHTML = dt.Rows[i].CategoryName;
}
else
{
var li = document.createElement("li");
li.className = "Closed";
li.id = "li_" + dt.Rows[i].CategoryID;
var img = document.createElement("img");
img.id = dt.Rows[i].CategoryID;
img.className = "s";
img.src = "css/s.gif";
img.onclick = function () {
ExpandSubCategory(this.id);
};
img.alt = "展开/折叠";
var a = document.createElement("a");
a.href = "javascript:ExpandSubCategory(" +
dt.Rows[i].CategoryID + ");";
a.innerHTML = dt.Rows[i].CategoryName;
}
li.appendChild(img);
li.appendChild(a);
ul.appendChild(li);
}
li_father.appendChild(ul);
displayDocList(iCategoryID);
switchNote(iCategoryID, false);
}
后台代码:
[AjaxMethod()]
public DataSet GetSubCategory(int iCategoryID)
{
DataSet ds = new DataSet();
SqlConnection conn =
new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = string.Format(
"SELECT CategoryID, CategoryName, FatherID, dbo.IsLeaf(CategoryID) as IsChild FROM Category WHERE FatherID = {0}",
iCategoryID);
SqlDataAdapter da = new SqlDataAdapter(cmd);
try
{
da.Fill(ds);
}
catch (SqlException)
{
}
finally
{
conn.Close();
}
System.Threading.Thread.Sleep(500 + rand.Next(1000));
return ds;
}
AjaxPro在.net2005已经换成支持net2.0的版本,运行ch51.Tree.GetSubCategory(iCategoryID, GetSubCategory_callback);调试过程中没进入断点,但在.net2003顺利通过,这是怎么回事?
前台javaScript脚本:
function ExpandSubCategory(iCategoryID)
{
var li_father = document.getElementById("li_" + iCategoryID);
if (li_father.getElementsByTagName("li").length > 0) //分类已下载
{
ChangeStatus(iCategoryID);
displayDocList(iCategoryID);
return;
}
li_father.className = "Opened";
switchNote(iCategoryID, true);
ch51.Tree.GetSubCategory(iCategoryID, GetSubCategory_callback);
}
//*************************************************
function GetSubCategory_callback(response)
{
var dt = response.value.Tables[0];
if (dt.Rows.length > 0)
{
var iCategoryID = dt.Rows[0].FatherID;
}
var li_father = document.getElementById("li_" + iCategoryID);
var ul = document.createElement("ul");
for (var i = 0;i < dt.Rows.length;i++)
{
if (dt.Rows[i].IsChild == 1) //叶子节点
{
var li = document.createElement("li");
li.className = "Child";
li.id = "li_" + dt.Rows[i].CategoryID;
var img = document.createElement("img");
img.id = dt.Rows[i].CategoryID;
img.className = "s";
img.src = "css/s.gif";
var a = document.createElement("a");
a.href = "javascript:OpenDocument('" + dt.Rows[i].CategoryID + "');";
a.innerHTML = dt.Rows[i].CategoryName;
}
else
{
var li = document.createElement("li");
li.className = "Closed";
li.id = "li_" + dt.Rows[i].CategoryID;
var img = document.createElement("img");
img.id = dt.Rows[i].CategoryID;
img.className = "s";
img.src = "css/s.gif";
img.onclick = function () {
ExpandSubCategory(this.id);
};
img.alt = "展开/折叠";
var a = document.createElement("a");
a.href = "javascript:ExpandSubCategory(" +
dt.Rows[i].CategoryID + ");";
a.innerHTML = dt.Rows[i].CategoryName;
}
li.appendChild(img);
li.appendChild(a);
ul.appendChild(li);
}
li_father.appendChild(ul);
displayDocList(iCategoryID);
switchNote(iCategoryID, false);
}
后台代码:
[AjaxMethod()]
public DataSet GetSubCategory(int iCategoryID)
{
DataSet ds = new DataSet();
SqlConnection conn =
new SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = string.Format(
"SELECT CategoryID, CategoryName, FatherID, dbo.IsLeaf(CategoryID) as IsChild FROM Category WHERE FatherID = {0}",
iCategoryID);
SqlDataAdapter da = new SqlDataAdapter(cmd);
try
{
da.Fill(ds);
}
catch (SqlException)
{
}
finally
{
conn.Close();
}
System.Threading.Thread.Sleep(500 + rand.Next(1000));
return ds;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货