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.


                    HTML CODING

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" Height="25px" OnTextChanged="TextBox1_TextChanged" Width="200px"></asp:TextBox>

                       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);


First Add the New Form - Add TextBox Set Property AutoPostBack=True

Next - Add Coding  Into TextBoxChanged

Next - Run[F5]  The Program - Enter The Characters - Remove Last Character.



Post a Comment