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

    Learn from how text are to display in text box

    i want to know how to use a text box to display only text in
  • #765173
    it is simple, just use .Text property of textbox to show text in textbox
    see below snippet
    Textbox1.Text = "test in Textbox";

    Hope it helps

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

  • #765174
    Hi Ahmed usman,
    Yes, Textbox1.Text = "abc" is the one you may be looking for.
    But "to display only text", that means do you want character only validation?
    Shashikant Gurav

  • #765176

    you can go through this piece of code in your code window


    Text1.Text="India is Big Country"

    if you need which you enter the value in your textbox shown in the screen means use this


    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #765181
    Hi Ahmed,

    As per my understand the post you want to enter only characters in textbox, if that is your requirement then my suggestion is instead of doing this in side better to do the same in client side either Jquery or javascript and call that function onKeyPress event of a textbox.


    <script type="text/javascript">
    function IsCharacter() {
    var element;
    element = event.srcElement;
    if ((event.keyCode >= 65&& event.keyCode <= 90) || (event.KeyCode >=97 && event.KeyCode <=122 )) {//to handle characters
    event.returnValue = true;
    event.returnValue = false;

    <asp:TextBox ID="txtChar" runat="server" width="90%" onkeypress="IsCharacter();" Enabled="false" />

    I didn't text this, if you still having any doubts then please refer below link

    Hope this will helpful to you....

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

    Blog :

  • Sign In to post your comments