Title: How to get Postback Data on LinkButton Click Event?
Tags: asp.net;.net
Question: I have a LinkButton in aspx page.

```<asp:TextBox ID="textBoxNote" runat="server" /&gt;
    <asp:LinkButton ID="linkButtonUpdateNote" Text="Update" OnClick="ButtonUpdateNoteClicked" runat="server" /&gt;  
```

the click event handler has the following code

``` protected void ButtonUpdateNoteClicked(object sender, EventArgs e)
        {
            var note = textBoxNote.Text;
        }
```

On Postback textBoxNote.Text is empty. I don't get the posted value. How to get the value?

Comment: I set the value to the textbox only on if it is not postback.

Comment: Does the `TextBox` gets an initial value somewhere? Remember to do that only on the first load and not on postbacks. Otherwise you would override the value always. The initial value does not need to be set on postbacks if you have enabled `ViewState`(default).

Here is the accepted answer: It seems like you are possibly resetting the value in your ```Page_Load```.

Check that you are using ```IsPostback``` check in the ```Page_Load``` function. see - http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx

```private void Page_Load()
{
    if (!IsPostBack)
    {
        DoThisOnce();
    }

    DoThisOnEachPostback();
}
```



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2012:00:12/03/12', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<asp.net><.net>', 'Title': 'How to get Postback Data on LinkButton Click Event?', 'ViewCount': 1369, 'id': 13682103, 'user_AboutMe': '<p>I am a software engineer trying to write good code!!!</p>\n', 'user_AccountId': 170286.0, 'user_DisplayName': 'RAM', 'user_Reputation': 856.0, 'user_Views': 77.0, 'user_id': 396881.0}}