我有一页面a.aspx中有段js代码
<script>
function showDetail(obj)
{
............
window.parent.frames("frmbottom").window.location= "b.aspx?cid=" + obj.EmpID
    window.parent.frames("frmbottom").window.document.form1.cid.value = obj.EmpID
....................
</script>
-------------------------
类文件a.aspx.vb中
在DataGrid_ItemDataBound事件中
            Dim EmpID= e.Item.Cells(0).Text
            e.Item.Attributes.Add("onclick", "showDetail(this)")但是运行是总说我“列名 'undefined' 无效”,同时我看到我的地址栏中是b.aspx?cid=undefined,说明我的参数没有生效。

解决方案 »

  1.   

    showDetail(this)这里的this是当前的htmlelment,它应该没有EmpID这个属性
      

  2.   

    那该如何传递传递喃,我的意思其实就是想点击datagrid的行时,把该行对应的id字段的值取道并传递
      

  3.   

    e.Item.Attributes.Add("onclick", "showDetail("+EmpID+")")
      

  4.   

    aspx.cs 
    string EmpID = ..... 
     e.Item.Attributes.Add("onclick", "showDetail("+EmpID +")")
    jsfunction showDetail(obj)
    {
    ............
    window.parent.frames("frmbottom").window.location= "b.aspx?cid=" + obj
        window.parent.frames("frmbottom").window.document.form1.cid.value = obj
      

  5.   

    a.aspx客户端中
    <script language="javascript">
    function showDetail(obj)
    {   
        URL = window.parent.frames("frmbottom").window.location.href
        if(URL.indexOf("equipment_list.aspx")==-1){
        window.parent.frames("frmbottom").window.location = "b.aspx?cid=" + obj + "&PageType=Base"
    return
    }
        window.parent.frames("frmbottom").window.document.form1.cid.value = obj
    strUrl=window.parent.frames("frmbottom").window.frames("main").location.href
    NewUrl = strUrl.substr(0,strUrl.indexOf("?")) + "?cid="+obj+ "&PageType=Base"
    window.parent.frames("frmbottom").window.frames("main").location.href = NewUrl
    }
    </script>
    a.aspx.vb中
    在MyDataGrid1_ItemDataBound事件下
            If e.Item.ItemIndex >= 0 Then
                Dim EmpID As String = e.Item.Cells(0).Text
                e.Item.Attributes.Add("onclick", "showDetail(" + EmpID + ")")
            End If
    b.aspx客户端中
    <input type="hidden" name="cid" value="<%=request.querystring("cid")%>">
    b.aspx.vb中
    Page_Load时间下
            Dim locationsrc As String
            If Request.QueryString("PageType") = "base" Then locationsrc = "c.aspx?cid=" & Request.QueryString("cid") & "&pagetype=" & Request.QueryString("PageType")
            myiframe.Attributes.Add("src", locationsrc)但是现在的问题是b.aspx中的cid隐藏域无法获取a.aspx中的cid值