Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all
i have a asp text box and i want
to convert this textbox to multiline by javascript code
ho can i do this
for example by click on text box i want to see multiline and mouseout to return single line
thanks in advance
Posted

Try below sample code
ASP.NET
<asp:textbox id="TextBox1" runat="server" textmode="MultiLine" rows="1" style="overflow:hidden" onclick="this.rows=10" onblur="this.rows=1"> </asp:TextBox>
 
Share this answer
 
v4
Comments
mhd.sbt 30-May-13 4:30am    
ok but i want create multi line text box dynamically by java script and this code
dont give me a good solution!!
Mahesh Bailwal 30-May-13 4:43am    
Below code is JavaScript code its not going to execute on server side.

onclick="this.rows=10" onblur="this.rows=1".
Member 10583355 2-May-14 0:59am    
dfdf
Quote:
click on text box i want to see multiline

To achieve above requirement you need to capture focus event of textbox.

Quote:
i have a asp text box and i want
to convert this textbox to multiline by javascript code

You can not convert asp.net server side textbox to multiline using client side scritp.
But you can renove that textbox and add new textarea using client side script.
I will show you using Jquery. You can easly do the same in javascript to.
XML
<script type="text/jscript" language="jscript">
    $(function () {
        $('#TextBox1').focus(function () {
            var newTextArea = document.createElement('TextArea');
            document.body.appendChild(newTextArea);
            $('#TextBox1').remove();
        })
    });
</script>

Where my asp.net textbox is.
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
 
Share this answer
 
Comments
Member 10583355 2-May-14 0:59am    
sdfasfasdfasf
<textbox id="Textbox1" runat="server" textmode="multiline">

Kishor Makwana
Software Engineer
Insight Softech
www.insightsoftech.com
 
Share this answer
 
Comments
Member 10583355 2-May-14 0:59am    
dfasdfadsf
Member 10583355 2-May-14 0:59am    
t easedfsa
Member 10583355 2-May-14 0:59am    
adsfasdfasfd

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