Use TextBox StartsWith() and Endswith() Function in ASP.NET

How to use TextBox StartsWith()  and Endswith() Function

- In ASP.Net we can find the Starting character and Ending character with the use of Startwith() and Endswith() Function in ASP.Net C#.

- Here we are going to learn in this ASP.Net Tutorials how to find the Starting and Ending Character in TextBox control with an ASP.Net Example.

 

- Write below code in Body Tag:-

<body>
    <form id=”form1″ runat=”server”>
<table>
                        <tr>
                            <td style=”width: 100px; text-align: right”>
                                Enter Value :</td>
                            <td style=”width: 100px”>
                                <asp:TextBox ID=”txtvalue” runat=”server”></asp:TextBox></td>
                            <td style=”width: 100px”>
                            </td>
                        </tr>
                        <tr>
                            <td style=”width: 100px”>
                            </td>
                            <td style=”width: 100px”>
                                <asp:Button ID=”btnsubmit” runat=”server” OnClick=”btnsubmit_Click” Text=”Submit” /></td>
                            <td style=”width: 100px”>
                            </td>
                        </tr>
                        <tr>
                            <td style=”width: 100px; text-align: right”>
                                </td>
                            <td colspan=”2″ style=”text-align: left”>
                                &nbsp;<asp:Label ID=”Label1″ runat=”server” Font-Bold=”True”></asp:Label></td>
                        </tr>
                    </table>
</form>
</body>

 

Write below code in Button Click Event :-

protected void btnsubmit_Click(object sender, EventArgs e)
    {
        if (txtvalue.Text.StartsWith(“meera”))
        {
            Label1.Text = “Value Start with ‘meera’ !”;
        }
        else
        {
            Label1.Text = “Value Dosn’t Start with ‘meera’ !”;
        }
}

TextBox Startswith() function in Asp.Net

TextBox Startswith() function in Asp.Net

 

TextBox Startswith() function in Asp.Net

TextBox Startswith() function in Asp.Net

- I hope you enjoy this ASP.Net TextBox Example Tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *

7 + 9 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">