Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a two text-boxes(Tb1-Adults, Tb2- Child) and a gridview on a page. The footer of gridview has "total amount" textbox in it which takes "PricePerPerson" value from database and calculates total amount using given above textboxes. How to do that without submitting the page(Without postback)?

What I have tried:

I've tried textchanged event of textbox event but, I'm unable to get value of textbox to gridview before postback.
Posted
Updated 22-Jul-17 3:19am

1 solution

Check the id & loop in javascript
Eg:

var i = 2;
var txt;
while(1)
{
txt =document.getElementById('GridView1_ctl0' + i.toString() + '_textboxid');
if(txt!=null)
{
// process your textbox
}
else
{
break; // all rows completed
}
}

Confirm your control ids by inspecting the controls in developer tools in browser and use them in above script.

In above script textboxid is your textbox rendered in footer of the grid.
 
Share this answer
 
Comments
sam_matte 22-Jul-17 10:43am    
thank you, it helped a lot.
Atlapure Ambrish 24-Jul-17 0:26am    
No problem, I am glad that it was helpful to you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900