日期:2014-05-19  浏览次数:20368 次

关于前台调用后台函数_各位大虾.......
我在page_load时对数据进行操作,后台调用前台,又需要前台调用后台,后这个怎么实现呢,代码是这个样子的:

page_load中有
For   Each   Cur   As   DataGridItem   In   DataGrid1.Items
                                Dim   id   As   String   =   Cur.Cells(5).Text
                                Cur.Cells(3).Attributes.Add( "onmouseover ",   "showtip(id); ")               ' "   &   Cur.Cells(3).Width.ToString   &   ", "   &   Cur.Cells(3).Height.ToString   &   "
                                Cur.Cells(3).Attributes.Add( "onmouseout ",   "hidetip(); ")
                                Next
这个是对datagrid1的数据的绑定时对某列调用前台的操作,前台有个层tip,希望在鼠标移动到这个列时出现相关信息,前台的代码:
function   showtip(id)
{

" <%   RtTable(id)%> "
var   lft=window.event.x;
var   tp=window.event.y;
document.all.tip.style.left=lft;
document.all.tip.style.top=tp;

window.document.all.tip.style.display= " "

}
其中RtTable(id)是后台的一个函数Public   Function   RtTable(ByVal   id   As   String)
功能是   对datagrid2进行数据绑定,好让它显示在层中,
可运行的结果是   在不管鼠标移动到这个列中的哪个数据,显示的总是第一个数据的内容信息,好象RtTable(id)只执行了一次,为什么啊.....

我说的应该算清楚吧..............

------解决方案--------------------
用ajax
------解决方案--------------------
ajax或者


protected string tip;
在后台取得tip内容,然后,js控制显示
------解决方案--------------------
你可以测试一下你的id,看是否变化.