Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
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
156.2
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
Frontend Developer Interview Questions and Answers
Read by 990 people
Download Now!
Learn
View all
Membership not found