I am new to asp.net. Here I am trying to create a chat application. In my project there is one label and one TextBox. whenever the user enters anything in TextBox and press `enter` the text will be shown in `Label`. I tried the below code:

**OnEnterKeyPress** of TextBox (.aspx.cs file)

```
        HttpRequest request = base.Request;           
        Ping p = new Ping();
        PingReply r;
        String s = request.UserHostAddress;  //using own IP address for understanding purpose.
        r = p.Send(s);
        Response.Buffer = false;
        if (r.Status == IPStatus.Success)
        {
            Label1.Text = TextBox1.Text;
        }

```

I dont know how to keep the enter event. (There are no events in TextBox properties as it were in C#)

Before asking here I checked many links like [Link1](https://stackoverflow.com/questions/13158752/fire-event-on-enter-key-press-for-a-asp-net-textbox) [Link2](https://stackoverflow.com/questions/13158752/fire-event-on-enter-key-press-for-a-asp-net-textbox) [Link3](https://stackoverflow.com/q/4254576/1577396) but no use. I could have used simple Javascript but the main code is in C# file.