Sunday, 1 March 2015

Remove Textbox Last Character Using Asp.Net C#

Remove Textbox Last Character


If I Enter  Numbers or Character In TextBox After Remove Last Character Of TextBox Values.


DEMO  



                
                    HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       
        <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" Height="25px" OnTextChanged="TextBox1_TextChanged" Width="200px"></asp:TextBox>
          
  </div>
    </form>
</body>
</html>



               
                       C# CODING


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
       
       
        TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length-1);


    }
}















0 comments:

Post a Comment