0

i am using Asp.Net Grid View Control having Template Field Columns. Which have Asp.Net Literal,TextBox and CheckBox Controls. I want to add each row Received Amount value when checkbox is Checked in each row. Below is my GridView.

enter image description here

I have accessed the Received Amount columns by JavaScript, but it gives me the whole Textbox in Alert enter image description here

I want to get Value of that Textbox having Id=txtFeeRecAmount, not whole Control.. Below is my Script..

<script type="text/javascript">
        function AddAmount(lnk) {
            var row = lnk.parentNode.parentNode;
            var rowIndex = row.rowIndex;
            alert(rowIndex);
            var amount = row.cells[2].innerHTML;
            alert(amount);
        }
</script>

Any Help, I want to get Value of Received Amount Column, when the CheckBox is checked.

2 Answers 2

1

As, there can be multiple textboxes. there you need to get the current value by using jquery, this should work;

 var amount = $(row.cells[2]).find('input').val();
Sign up to request clarification or add additional context in comments.

Comments

0

As you tagged this question with jQuery I assume you are using it:

I want to get Value of that Textbox having Id=txtFeeRecAmount

$("#txtFreeRecAmount").val();

3 Comments

its give me undefined
@ShahidIqbal, checkout my answer
There's a piece of the puzzle missing if you are getting undefined. Quick sample fiddle..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.