0

I am trying to read the HTML5 Textarea's (not ASP.NET textbox control) text and pass it to my aspx.vb code at the back of the web page. How can I do it?

If can't, can I use JavaScript or other language pass the value to my back end vb code?

<textarea name="content"id="textarea" cols="90" rows="20"runat="server">
</textarea>
JimiLoe
  • 950
  • 2
  • 14
  • 22
  • What have you tried? Knowing more about the structure of your page and how it is communicating with the server will help to answer your question. Please read[How do I ask a good question?](http://stackoverflow.com/help/how-to-ask). – Jason Aller Mar 14 '14 at 18:05

4 Answers4

2

on .aspx page, html text area -

<textarea runat="server" name="exampleTextArea" id="exampleTextArea"></textarea>

on .vb code behind page, you can get the value by calling this -

Me.exampleTextArea.Value

FULL EXAMPLE TO CALL THIS VALUE -

Dim textAreaValue as String = Me.exampleTextArea.Value
Zhaph - Ben Duguid
  • 26,785
  • 5
  • 80
  • 117
display name
  • 4,165
  • 2
  • 27
  • 52
1

Here I tried one way may be it will help you

enter code here
<head id="Head1" runat="server">
<title>Pass Javascript Variables to Server</title>
<script type="text/javascript">
     function Set()
     {
        var a = '<%= inpt.ClientID %>';
        document.getElementById(a).value=jsVar;
     }
</script>
</head>

<body onload="Set()">
<form id="form1" runat="server">
<div>  
    <input id="inpt" type="text" runat="server"  />  
    <asp:TextBox ID="txtJSValue" runat="server"></asp:TextBox>
<asp:Button ID="btnJSValue" Text="Javascript Variable"runat="server" onclick="btnJSValue_Click"/>
</div>
</form>

</body>




*double click on button and type*`enter code here`
 enter code here
protected void btnJSValue_Click(object sender, EventArgs e)
{
    txtJSValue.Text = inpt.Value;
}
Albert Xing
  • 5,620
  • 3
  • 21
  • 40
user3417203
  • 25
  • 1
  • 2
  • 9
0

Someone else wrote something about this (in c# but You can convert using some online converter). Here is link : Get textarea in codebehind

Of course, You can use TextBox and set TextMode="Multiline"... but If You won't then link above.

Community
  • 1
  • 1
nelek
  • 4,074
  • 3
  • 22
  • 35
0

Html5 textarea its just a misunderstand, but,anyway, set attribut name to your textarea, then if your textarea are in a runat server form, in the code behind, in the page load event you can easily test if request["textareaName"] exist and if exist you can read the value directly from Request

ale
  • 10,012
  • 5
  • 40
  • 49