I had the issue where i have a asp.net textbox inside a gridview and I wanted to call client side code onblur event.
i was able to do that with the following code and now the issue is how do I pass some of the values bound to the row to the btnClick event, I have the button outside of the gridview mabye if i put it inside the gridview then I can get some values. is it
possible to bind many values and pass th ose in as the command args, perhaps in an array.
MyronCope
Participant
1656 Points
1345 Posts
pass values of gridview from javascript to code behind
Nov 06, 2012 02:31 PM|LINK
using asp.net/vb.net 2010
I had the issue where i have a asp.net textbox inside a gridview and I wanted to call client side code onblur event.
i was able to do that with the following code and now the issue is how do I pass some of the values bound to the row to the btnClick event, I have the button outside of the gridview mabye if i put it inside the gridview then I can get some values. is it possible to bind many values and pass th ose in as the command args, perhaps in an array.
my textbox
the javascript
function testBtnClick() { alert('inside testBtnClick'); var btn = document.getElementById('btnUpdate'); alert('btn: ' + btn); if (btn) btn.click(); }and the code behind, i put a breakpoint here and its hitting this code when onblur is thrown
Private Sub btnUpdate_Click(sender As Object, e As System.EventArgs) Handles btnUpdate.Click Dim sTest As String sTest = "test" End Subto restate i want to pass several of the values that were bound to that gridview row so I can use these value to perform calculations
how to get values from client side to server side using my code?
I think to pass from my control to the javascript i can do somethiung like this:
but then how do I pass these (and more) values from the javascript to my btnClick event?
thanks
MC
roopeshreddy
All-Star
20135 Points
3323 Posts
Re: pass values of gridview from javascript to code behind
Nov 06, 2012 03:49 PM|LINK
Hi,
Since you are using GridView, why don't you get the values in the Server side, instead of passing from Client side!
Check this - http://csharp-guide.blogspot.com/2012/05/gridview-commandargument-passing.html
Hope it helps u...
Roopesh Reddy C
Roopesh's Space