Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
1. How can i set the ViewData or TempData value from jQuery ?
2. How can i get the Hidden Field Value to render the view in MVC 2.
like:

HTML
<input type ="hidden" id="hide" />



<%:Here how can i get the hidden field data? %>
Posted

1 solution

Hi,

Following are the answers of your question:

1. How can i set the ViewData or TempData value from jQuery ?
You can not set the value of ViewData or TempData using JQuery. but you can pass the any value as Query or JSON format.

2. How can i get the Hidden Field Value to render the view in MVC 2.
You can get hidden field value using javascript. use following code to get value
JavaScript
<script lang="javascript">
function getHiddenValue()
{
   var hidenvalue =  documetn.getElemetById('hide').value;
   alert("Value in hidden field is : " + hidenvalue); 
}
</script>
 
Share this answer
 
Comments
zyck 4-Feb-12 12:53pm    
Hi Sunasara,
how about passing or Retrieving the hiddenvalue to Controller on MVC3?

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