You must Sign In to post a response.
  • Category: ASP.NET

    Textarea value passing

    want to pass one textarea text to another textarea when clicked a radiobutton
  • #767244
    you can use javascript for it, see below snippet

    < script language = "javascript">
    function copyTextareaText()
    var text1 = document.getElementById("txt1").value;
    document.getElementById("txt2").value = text1;
    return false;
    < /script>
    //call above function on radio button click
    < asp:radiobutton id="rb1" runat="server" text= "click me" onclick="return copyTextareaText()"/>

    in above sample on click of radio button javascript function gets called and executed successfully
    hope it helps

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #767246

    What did you do on radio button selection whether did you call server side code or client side code? If you are using client side code use below sample code this will help you to copy one textarea content into another textarea.


    Hope this will helpful to you...

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #767255
    You can try this:
    .aspx Code:

    <textarea id="txtArea1" runat="server" >Enter text here...</textarea>
    <textarea id="txtArea2" runat="server">Enter text here 2...</textarea>
    <asp:RadioButton Text="Select This" runat="server" AutoPostBack="true" OnCheckedChanged="Unnamed_CheckedChanged" />

    .cs Code:

    protected void Unnamed_CheckedChanged(object sender, EventArgs e)
    txtArea1.Value = txtArea2.Value;

  • Sign In to post your comments