Read from HTML TextFiled (Client Side)
-
Hi Everyone How to pass a value from an HTML Textfiled (client side) to TextBox (Server Side)?????:confused: Thanks
Hi, Are you talking about from an <INPUT type='text'> to an asp:textbox ?? If so why not just make the <INPUT type='text'> a server control, e.g.
<INPUT type='text' id='myTextbox' runat='server' name='myTextbox' value=''/>
and then declare it at the server-side...
protected System.Web.UI.HtmlControls.HtmlInputText myTextbox;
...
...
...
...Hope this helps, Andy
-
Hi Everyone How to pass a value from an HTML Textfiled (client side) to TextBox (Server Side)?????:confused: Thanks
Hi Please follow the instruction for passing the value of HTML object to a server side object 1st Step; add runat=server attribute to HTML object you want to access in code behind ex. 2nd Step; Declare the HTML Control object in code behind ex. Public Class MyPage1 Protected WithEvents WebControlTxtbox As System.Web.UI.WebControls.TextBox Protected WithEvents HtmlControlTxtbox As System.Web.UI.HtmlControls.HtmlInputText Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ..... End Sub End Class 3rd Step; Set the value of HtmlControlTxtbox to WebControlTxtbox ex. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WebControlTxtbox.Text = HtmlControlTxtbox.Value End Sub Happy Coding Mark
-
Hi Everyone How to pass a value from an HTML Textfiled (client side) to TextBox (Server Side)?????:confused: Thanks
By the way you can do this in a simplest way if you want by controlling this in a dynamic script. ex. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load page.registerstartupscript("MyScript1","ServerControlTxtbox.value = HTMLControlTxtBox.value") End Sub Hi But if you want
-
Hi Everyone How to pass a value from an HTML Textfiled (client side) to TextBox (Server Side)?????:confused: Thanks
By the way you can do this in a simplest way if you want by controlling this in a dynamic script. ex. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load page.registerstartupscript("MyScript1","ServerControlTxtbox.value = HTMLControlTxtBox.value") End Sub Happy Coding Mark Hi But if you want
-
Hi Please follow the instruction for passing the value of HTML object to a server side object 1st Step; add runat=server attribute to HTML object you want to access in code behind ex. 2nd Step; Declare the HTML Control object in code behind ex. Public Class MyPage1 Protected WithEvents WebControlTxtbox As System.Web.UI.WebControls.TextBox Protected WithEvents HtmlControlTxtbox As System.Web.UI.HtmlControls.HtmlInputText Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ..... End Sub End Class 3rd Step; Set the value of HtmlControlTxtbox to WebControlTxtbox ex. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WebControlTxtbox.Text = HtmlControlTxtbox.Value End Sub Happy Coding Mark