ajax方法返回dataset,在掉用ajax方法问题

shizhusz110 2008-09-15 04:23:55
我先用ajax方法返回一个dataset,在掉用一个函数来根据dataset的数据生成控件和付值,在付值的时候又要调用个ajax方法,可是调用该方法的时候数据不能返回??谢谢回复!!

MeProtypeYfZk.prototype.CreateUpdateControl=function(bh)
{
//alert(bhyfzk+"zyrs");
if(bh!=-1)
{
try
{
var ds= CWXT.CWDJ.CKJF.GetDataSet(bh,"cwgl_pz_yfzk");// cwgl_pz_yfzk
if(ds){
this.GetDataSet_CALL_BACK_YFZK(ds);
}
}
catch(ex)
{
}
}
}
MeProtypeYfZk.prototype.GetDataSet_CALL_BACK_YFZK=function(response)
{
if(response.value==null)
return;
var ds=response.value;
if(ds.Tables[0].Rows.length==0)return;
if((ds!=null)&&(typeof(ds)=="object")&&(ds.Tables!=0))
{
for(var i=0;i<ds.Tables[0].Rows.length-1;i++)
{
this.AddRow();
}
this.InitControlValue(ds);
}
}
MeProtypeYfZk.prototype.InitControlValue=function(ds)
{
var obj=document.getElementById(this.tableid);
for(var i=0;i<ds.Tables[0].Rows.length;i++)
{
tr=obj.rows[(i+1)];
for(var j=2;j<tr.childNodes.length;j++)
{
td=tr.childNodes[j];
input=td.firstChild;
if(j==2)
{
input.value= ds.Tables[0].Rows[i].khjlh;
input=td.childNodes[1];
//alert(CWXT.CWDJ.CKJF.GetValueForCondition("cwgl_jc_gykh","mc",ds.Tables[0].Rows[i].khjlh));
//alert(d1);
//if(d1)
// {
input.value=ds.Tables[0].Rows[i].khjlh;
//}
}
else if(j==3)
{

input.value=parseFloat(ds.Tables[0].Rows[i].je.toString()).toFixed(2)/100;
}
else
{
input.value=ds.Tables[0].Rows[i].zy;
}
}
}
}


[AjaxPro.AjaxMethod]
public DataSet GetDataSet(string bh,string table)
{
string sql=" select * from "+table+" where pzjlh="+bh;
DataSet ds=new DataSet();
ds=func.func1.ExeSelect(sql);

return ds;
}

[AjaxPro.AjaxMethod]
public DataSet GetValueForCondition(string table,string filed,string values)
{
string sql="select "+filed+" from "+table+" where bh="+values;

DataSet ds=new DataSet();
ds=func.func1.ExeSelect(sql);

return ds;
}
...全文
105 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
shizhusz110 2008-09-15
  • 打赏
  • 举报
回复
谢谢两位的回复?我现在做了联合查询,一次就可以了,问题也解决了?但是上面错误我还是不知道怎么会出现那样的??
wangkun9999 2008-09-15
  • 打赏
  • 举报
回复
在catch(ex)中捕获下,看报什么错误?
JeffChung 2008-09-15
  • 打赏
  • 举报
回复
感觉这样的设计有点问题

你现在是先取一个表回客户端,然后再根据表的一些值又去服务端取N次表
应该可以整在一起的吧,一次交互就把所有的数据传过去,因为一个dataset可以有多个表

shizhusz110 2008-09-15
  • 打赏
  • 举报
回复
如果我在注释的代码地方不调用ajax方法来返回是句,直接用上一个dataset返回的数据付值就没问题,起他控件就能付到值!但是如果调用ajax方法的话就不行,ajax(GetValueForCondition)不能返回数据集,页没就不加载了,其他控件没值!!!

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧