Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Windows Form has WebBrowser Control, button "Login" and button "Get data". When i click button Login: login website A (I passed). When i logined, WebBrowser return 3 frame (top frame, left frame and center frame).

Center frame shows all product (product name, product price, ...). After 1 minute, this frame refresh. This frame has:

<iframe name="Data" src="" style="display: none"></iframe>
<form action="GetPrice.aspx" target="Data" name="GetPrice" style="display: none">
<input type="hidden" name="hidPID" value="123" />
<input type="hidden" name="hidC" value="5" />
</form>


The follow result in browser:

<script language="javascript">
var NameP = "Product 123";
var CodeP = "123";
var UnitP = "123,456";
</script>

How to get this result when i click button "Get data"? Help me!

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 16-Mar-11 22:19pm
v2
Comments
Micha3ldg 17-Mar-11 4:48am    
the button login and button get data is windows control? or it is inside html/frame?
Nguyen Tuan 17-Mar-11 5:50am    
the button login and button get data is Windows Control

Try this one. It has sample code.

Communication to and from Iframes[^]
 
Share this answer
 
Comments
Nguyen Tuan 17-Mar-11 5:51am    
Thanks, but this is not solution. I'm using C#
First ID to the iframe, like

XML
<iframe id="Data" name="Data" src="" style="display: none"></iframe>


JavaScript:

JavaScript
var frameDocument = document.getElementById('Data').contentWindow().document;


using frameDocument you can access anything in the iframe.
 
Share this answer
 
Comments
Dalek Dave 17-Mar-11 4:38am    
Good Call.
Nguyen Tuan 17-Mar-11 5:51am    
Thanks, but this is not solution. I'm using C#
Venkatesh Mookkan 17-Mar-11 6:44am    
You cannot access the controls inside the iframe from the code-behind (C#). The content inside the IFrame is altogether a new Page which cannot be accessed from another page.

You can access using JavaScript and assign the values in a HiddenField (runat Server) and use it from the CodeBehind (C#)

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