Textbox values cleared on button click RRS feed

  • Question

  • Textboxes values are cleared on button click in asp.net. How to avoid it.

    <asp:Button ID="btnRefresh" runat="server" CssClass="btn btn-primary" Text="Refresh" OnClientClick="return setFormSubmitToFalse();" OnClick="btnRefresh_Click"></asp:Button>

       function setFormSubmitToFalse() {
            _spFormOnSubmitCalled = false;
            _spSuppressFormOnSubmitWrapper = true;
            return true;

    • Edited by scorpion_28 Friday, February 8, 2019 11:25 AM
    • Moved by CoolDadTx Friday, February 8, 2019 2:48 PM ASP.NET related
    Friday, February 8, 2019 11:24 AM

All replies

  • Hello,

    >How to avoid it.

    1. Use AJAX and make async call to the server

    2. Ensure that what was entered will be re-entered in replay. 

    I think your option is 2.

    Sincerely, Highly skilled coding monkey.

    Friday, February 8, 2019 11:34 AM
  • Please post questions related to ASP.NET in the ASP.NET forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Friday, February 8, 2019 2:48 PM