Click here to Skip to main content
15,893,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
CSS
I have tried with the below code but i am not able to get that value.

In View
<input type="hidden" id="hiddenTab" name="hiddenTab" value="10" />

In controler
string currentHiddenvalue = Request.Form["hiddenTab"];


Is it possible to provide guid to hidden field in layout.
Posted
Comments
F-ES Sitecore 27-Oct-15 11:21am    
That code should work but you have to check that input field is part of the form that is submitted to your action.
Krunal Rohit 27-Oct-15 13:32pm    
Try using FormCollection.

-KR

1 solution

All fileds of a form are submitted on POST, indifferent of the type, thus also the hidden ones. Check your http traffic to see, if the field is part of the POST body. Use Fiddler or the network inspectors in IE10+ or Chrome. Firefox has also an inspector as add-in. It should be there, if not, your html form is not valid. On controller side you better use mapping by adding the necessary action method parameter, or model binding. Still, this works too[^]. But not in the controller constructor!
And simply debug your action method and see what's in the Request variable.
 
Share this answer
 
v2

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