locked
Value in Repeater RRS feed

  • Question

  • User-1937501809 posted

    Why this is not working.??

    <asp:TextBox ID="txtPrincipalAmt" runat="server"  Width="150px" onkeypress="return isNumberKey(event)" onblur= 'CheckCorr(<%#Eval("ToPaid") %>);' ></asp:TextBox>

    Tuesday, August 9, 2016 11:37 AM

Answers

  • User61956409 posted

    Hi sandip5264,

    onblur= 'CheckCorr(<%#Eval("ToPaid") %>);'

    You could refer to the following sample code to pass data field value to your JavaScript function CheckCorr.

    <asp:TextBox ID="txtPrincipalAmt" runat="server" onblur='<%#String.Format("CheckCorr({0})", Eval("ToPaid") ) %>'></asp:TextBox>

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 10, 2016 3:18 AM
  • User61956409 posted

    Hi sandip5264,

    You could pass current object (textbox) to function, and then you could use $(obj).val() to get the value of user input.

    <asp:TextBox ID="txtPrincipalAmt" runat="server" onblur='<%#String.Format("CheckCorr({0},this)", Eval("ToPaid")) %>'></asp:TextBox>
    function CheckCorr(pid, obj) {
        alert(pid + "," + $(obj).val());
    }
    

    Best Regards,

    Fei Han



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 11, 2016 2:41 AM

All replies

  • User3690988 posted

    It's almost impossible to tell without seeing the code for CheckCorr.  Please post that code.  Also, try using your browser's developer tools to debug (F-12 if you are using IE).

    Tuesday, August 9, 2016 1:21 PM
  • User61956409 posted

    Hi sandip5264,

    onblur= 'CheckCorr(<%#Eval("ToPaid") %>);'

    You could refer to the following sample code to pass data field value to your JavaScript function CheckCorr.

    <asp:TextBox ID="txtPrincipalAmt" runat="server" onblur='<%#String.Format("CheckCorr({0})", Eval("ToPaid") ) %>'></asp:TextBox>

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 10, 2016 3:18 AM
  • User-1937501809 posted

    Works fine for me just tell me one more thing I also have to pass value entered in txtPrincipalAmt textbox to the function CheckCorr.  Will you please tell me how could I pass both the values to javascript function.

    Wednesday, August 10, 2016 7:50 PM
  • User61956409 posted

    Hi sandip5264,

    You could pass current object (textbox) to function, and then you could use $(obj).val() to get the value of user input.

    <asp:TextBox ID="txtPrincipalAmt" runat="server" onblur='<%#String.Format("CheckCorr({0},this)", Eval("ToPaid")) %>'></asp:TextBox>
    function CheckCorr(pid, obj) {
        alert(pid + "," + $(obj).val());
    }
    

    Best Regards,

    Fei Han



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 11, 2016 2:41 AM