Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7631037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:15:04+00:00 2026-05-31T06:15:04+00:00

I would like to disable postback on a onClick event of a button. I

  • 0

I would like to disable postback on a onClick event of a button.

I did some research online and most are using onClientClick and using javascript. Is there a way to call a asp.net function “btnCommit_Click” on the onClick instead of using onclientclick and using javascript?

If not, how would I be able to incorporate a asp.net function with javascript?

<asp:Button ID="btnCommit" runat="server" Text="Save" TabIndex="5" 
    onclick="btnCommit_Click" />

UPDATED
I have a GridView which contains checkboxes, once the user makes their changes and click on a “Save Button” a Post Back occurs and I loose all the selections made to the checkboxes I was thinking of disabling the postback on the OnClick Event of the button would solve that issue…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:15:05+00:00Added an answer on May 31, 2026 at 6:15 am

    I have a GridView which contains checkboxes, once the user makes their
    changes and click on a “Save Button” a Post Back occurs and I loose
    all the selections made to the checkboxes

    You have to keep the Page_Load under Page.IsPostback during is’s value to false like below..

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //Your code
        }
    }
    

    This will not cause to loose you grid checkbox selection made after clicking the button.


    Your GridView EnableViewState must be True


    Your template fields must be in designer page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to disable a complete buttonset on button click using jquery Until
I would like to disable onclick event with CSS. Possible? Let's say I have
I have following HTML and would like to disable the link using javascript. <a
Ok, let's say that I have a button and I would like to enable/disable
I am generating some PDF's and I would like to disable the header on
Env: jQuery, richfaces We would like to disable copying (using CTRL+A) sensitive information on
I have a radiobutton list and would like to disable some items according to
When I press a button, I would like to disable screen rotation on all
I am using Ruby on Rails 3 and I would like to disable and
I am deploying an app using click once where I would like to disable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.