Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to Get TextBox value from GridView using JavaScript
WhatsApp
Vishvajeet Pawar
4y
155.9
k
0
2
25
Blog
First Design Gridview as
:
<asp:GridView ID=
"GVReue"
runat=
"server"
">
<Columns>
<asp:TemplateField HeaderText=
"Item Name"
>
<ItemTemplate>
<asp:Label ID=
"lblItemName"
Text=
' <%# Eval("fldItemName") %>'
runat=
"server"
></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText=
"Quantity"
>
<ItemTemplate>
<asp:TextBox ID=
"txtQty"
ToolTip=
' <%# Eval("fldQuntity") %>'
onblur=
"Calculation(this.value)"
runat=
"server"
/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No Record Found....!!!
</EmptyDataTemplate>
</asp:GridView>
Design as
Then Use Script in Head tag as
<script type=
"text/javascript"
>
function
Calculation() {
var
grid = document.getElementById(
"<%= GVReue.ClientID%>"
);
for
(
var
i = 0; i < grid.rows.length - 1; i++) {
var
txtAmountReceive = $(
"input[id*=txtQty]"
)
if
(txtAmountReceive[i].value !=
''
) {
alert(txtAmountReceive[i].value);
}
}
}
</script>
Then Get value of TxtQty Textbox as
How to Get TextBox value from GridView using JavaScript
Up Next
Get And Set Variable Values From One JavaScript File To Another JavaScript File Using Local Storage
Ebook Download
View all
Voice of a Developer: JavaScript From Scratch
Read by 10.9k people
Download Now!
Learn
View all
Membership not found