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.
Who is Participating?
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

rwheeler23Author Commented:
Thank you for this useful tip.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.