locked
Listview Javascript : Uncaught SyntaxError: missing ) after argument list RRS feed

  • Question

  • User-712926555 posted

    Hi i am using Listview, In ItemTemplate

    <a runat="server" onclick='PayingProcess(this, "<%#Eval("Id") %>");'  > Pay </a>

    In Javascript

    function PayingProcess(obj,EdtId) {
    	alert(obj);
    }

    It shows Uncaught SyntaxError: missing ) after argument list

    Also tried

    onclick='string.Format("return PayingProcess("{0}", "{1}");", this,<%# Eval("Id") %>)'

    It show error same as above

    Friday, May 13, 2016 12:13 PM

Answers

  • User2103319870 posted

    It shows Uncaught SyntaxError: missing ) after argument list

    You can try with the below code

    <a href="#" runat="server" onclick='<%# String.Format("javascript:PayingProcess(\"this,{0}\")", Eval("Id").ToString()) %>'  > Pay </a>



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 13, 2016 2:22 PM
  • User-271186128 posted

    Hi Hisanth,

    With reference to A2H's code, I suggest you can use the following code:

     <a href="#" runat="server" onclick='<%# String.Format("javascript:PayingProcess(this,{0})", Eval("UserID").ToString()) %>'  > Pay </a>
    

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 14, 2016 3:31 AM

All replies

  • User2103319870 posted

    It shows Uncaught SyntaxError: missing ) after argument list

    You can try with the below code

    <a href="#" runat="server" onclick='<%# String.Format("javascript:PayingProcess(\"this,{0}\")", Eval("Id").ToString()) %>'  > Pay </a>



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 13, 2016 2:22 PM
  • User-271186128 posted

    Hi Hisanth,

    With reference to A2H's code, I suggest you can use the following code:

     <a href="#" runat="server" onclick='<%# String.Format("javascript:PayingProcess(this,{0})", Eval("UserID").ToString()) %>'  > Pay </a>
    

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 14, 2016 3:31 AM