asp.net将参数传递给listview中的js函数

时间:2012-06-04 12:32:35

标签: asp.net

我想在listview中将参数传递给我的js函数。我用一个参数做到了。像那样:

 <asp:Button ID="btnRezAktar" runat="server" Text="Aktar" OnClientClick='<%# "SubmitPage(" + Eval("o_no") +" );"%>' />

 <script language="javascript">
        function SubmitPage(o_no) {
            window.opener.document.getElementById('txtRoomNo').value = o_no.toString();
            this.close();
        }
    </script>

但我想传递两个参数,它不起作用:

<asp:Button ID="btnRezAktar" runat="server" Text="Aktar" OnClientClick='<%# "SubmitPage(" + Eval("o_no") + "," + Eval("k_ad") + " );"%>' />

 <script language="javascript">
        function SubmitPage(o_no, k_ad) {
            window.opener.document.getElementById('txtRoomNo').value = o_no.toString();
             window.opener.document.getElementById('txtNameSurname').value = k_ad.toString();
       this.close();
        }
    </script>

这有什么问题?

1 个答案:

答案 0 :(得分:0)

OnClientClick='<%# Eval("o_no", "SubmitPage(\"{0}\", ") + Eval("k_ad", "\"{0}\")") %>'