Data Grid View with added check box

I have a dgv that I have added a check box to the grid. I have discovered that even though I see the check box on the screen it is not really there until I refresh the screen. When I loop through the dgv the first time, I will get the message "Object not set to an instance of an object" when it hit this added column. If I refresh the screen I do not get this message. Is there some sequence I need to follow so that  a checkbox can be added to the dgv and then have the screen refreshed upon initially opening the form? This is VS C#. I think I am missing something when it comes to understanding what happens behind the scenes when a form is initially presented.
LVL 1
rwheeler23Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Maheshwar RSoftware DeveloperCommented:
Add the following line in your page_load event
  if (!(Page.IsPostBack == true))
        {

                      // write the grid bind code here 
          
        }
 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rwheeler23Author Commented:
Thank you for this useful tip.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.