I have googled the hell out of this one and I just cant get any further forward, I have a button sitting in an ASP Formview, that calls a Bootstrap Modal that contains 2 textboxs. When the user clicks on the Enter button on the Modal it should call javascript function to transfer those 2 values to 2 ASP:Textbox's sitting on the Formview. The JavaScript function is as follows:- <pre lang="Javascript"> $('#myModal').on('click', '.btn-primary', function () { var value = $('#chqNumber').val(); var value2 = $('#chqAmount').val(); $('#paymentIDTextBox').val(value); $('#paidAmountTextBox').val(value2); $('#myModal').modal('hide'); });
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModal" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title" id="exampleModalLabel">Input parameters</h4> </div> <div class="modal-body"> <div class="form-group"> <label for="recipient-name" class="form-control-label">Cheque Number:</label> <input type="text" class="form-control" id="chqNumber" > </div> <div class="form-group"> <label for="message-text" class="form-control-label">Cheque Value:</label> <input type="text" class="form-control" id="chqAmount"> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal"> Close </button> <button id="paramsOkay" type="button" class="btn btn-primary"> Enter </button> </div> </div> </div> </div>
I have put an alert box in the javascript function and that gets the right value, I have attempted to reference the ASP:textbox by client.ID, but cant get it to even pass muster in intelisense <pre lang="Javascript"> mytextbox = document.getElementById("<%= paymentIDTextBox.ClientID %>");
ClientIDMode="Static"
paymentIDTextBox
paidAmountTextBox
$("#paymentIDTextBox")
$("input[name='ctl00$MainContent$FormView1$paymentIDTextBox']")
document.getElementById
.val()
$("#paidAmountTextBox").val(value2);
document.getElementById("paidAmountTextBox").value = value2;
FindControl
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)