Hi..
I am using a webbrowser control in my form program and i am displaying an html page. There is 1 textbox in html page and id is "textbox". When someone write something in textbox, i want to use this text and save it to db. It will be work like this; somebody is writing somethings in textbox(in html page) and when press the button(form button), i want to save this text.
I suppose I should use innerhtml but actually i dont know how use it?
Loading
yokzuPosted Sep 25, 2009, 8:09 AM
Rajeswari nathanPosted Sep 25, 2009, 6:42 AM
It mean by "hmk". So you can get textbox value in the butten click
txt = ((Textbox) hmk.findcontrol("Textbox1")).Text
yokzuPosted Sep 25, 2009, 6:26 AM
The textbox is in hmk page, so there is no meaning creating a new textbox. There is a webbrowser control and it has a textbox(in html page). and then in form, there is a button. when a user write "example" in textbox(in html page), and then click the button, I want to catch this "example".
string txt = ...................; ----> txt must be what user write in textbox.
Rajeswari nathanPosted Sep 25, 2009, 6:16 AM
Follow the correct steps.
1. Create one user control have the text box of id "Textbox1"
2. Register that controls as follows
<%@ Register TagPrefix="scott" TagName="header" Src="~/WebUserControl.ascx" %>
3. Following the user control in your page.
<scott:header ID="MyHeader" runat="server" />
4. In the page load you can get the "Textbox1" as following code.
String Myvalue = ((TextBox)(MyHeader.FindControl("Textbox1"))).Text
The above is one sample example ...
yokzuPosted Sep 25, 2009, 5:19 AM
I am getting this errow when i try your code;
System.Windows.Forms.UserControl' does not contain a definition for 'FindControl
Rajeswari nathanPosted Sep 25, 2009, 2:43 AM