I'm making an ajax request and storing my response in an hidden field.I'm doing this through javascript using getelementbyid.value.This javascript function is on body onload.Now after I get this value I would like to use this in C#.I can't have any button onclick event or anything of that sort.Just have a hidden input type
I'm making an ajax request and storing my response in an hidden field.I'm doing this through javascript using getelementbyid.value.This javascript function is on body onload.Now after I get this value I would like to use this in C#.I can't have any button onclick event or anything of that sort.Just have a hidden input type
c#
javascript
asp
ajax
Share
Improve this question
asked Nov 12, 2010 at 5:25
gizgokgizgok7,6692323 gold badges8787 silver badges128128 bronze badges1
As per my understanding u cant use script variable on server side. Also can u put some piece of code here?
– Amit Soni
CommentedNov 12, 2010 at 5:27
Add a ment
|
1 Answer
1
Reset to default
5
If an asp HidenField webControl has a value then all you need to do is the following:
While you CAN use a value of an asp HiddenField that is set using javascript in C# make sure that you understand that this can only be done after a postback.
Here is some info on the Client/Server relationship. Javascript and C# respectively in your question.