Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Using below Iframe i want to pass hidden field value to controller action.
This is the Iframe i am using
---------------------------
HTML
<!DOCTYPE html>
<html>
<body>
<iframe src="http://localhost:61536/home/commonloginaetm height="200" width="300"></iframe>
 <input type="hidden"  name="TRAVELLER_FIRST_NAME" value="FirstName">
 <input type="hidden" name="TRAVELLER_LAST_NAME" value="Norway">
 <input type="hidden" name="TRAVELLER_EMAIL" value="Email">
</body>
</html>


Controller action
-----------------
C#
public ActionResult CommonLoginAETM(FormCollection objForm)
      {
          
          string strFirstName = Request.Form["TRAVELLER_FIRST_NAME"];
}


the above code not working at my end. Please kindly help me on this. How to read iframe hidden field value in controller action method.

What I have tried:

Using below Iframe i want to pass hidden field value to controller action.
This is the Iframe i am using
---------------------------
HTML
<!DOCTYPE html>
<html>
<body>
<iframe src="http://localhost:61536/home/commonloginaetm height="200" width="300"></iframe>
 <input type="hidden"  name="TRAVELLER_FIRST_NAME" value="FirstName">
 <input type="hidden" name="TRAVELLER_LAST_NAME" value="Norway">
 <input type="hidden" name="TRAVELLER_EMAIL" value="Email">
</body>
</html>


Controller action
-----------------
C#
public ActionResult CommonLoginAETM(FormCollection objForm)
      {
          
          string strFirstName = Request.Form["TRAVELLER_FIRST_NAME"];
}


the above code not working at my end. Please kindly help me on this. How to read iframe value in controller action method.
Posted
Updated 26-Aug-16 0:41am
v2
Comments
F-ES Sitecore 26-Aug-16 6:51am    
I don't understand your markup. You have an iframe and then some hidden fields below the iframe (not in it). Where does the iframe come in all of this? What do you want read from where and sent to where?
vulisiramu 26-Aug-16 7:00am    
Thanks for reply..
We are having a requirement to pass the hidden field values into the controller action.
Then based on the values we will do the operation.
if the hidden fields are inside the iframe then is there possiblity to pass the value. Please help me on this issue.
vulisiramu 26-Aug-16 7:32am    
Hi F-ES sitecore,
Please help on this issue.
F-ES Sitecore 26-Aug-16 8:02am    
I'm afraid I still don't really understand what you're trying to do.
vulisiramu 26-Aug-16 8:24am    
we will shared below url to client

http://localhost:61536/home/commonloginaetm

and my controller(home) action(commonloginaetm) should read the hidden field values from IFrame to the action(commonloginaetm).

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