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 8383255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:07:13+00:00 2026-06-09T17:07:13+00:00

When page is load than datagridview will be bind from database. I need row

  • 0

When page is load than datagridview will be bind from database.

I need row enter event for selecting row and based on retriving data from database.

But at load time it should not happen. How can I do this ?

This is my code

private void dgStation_RowEnter(object sender, DataGridViewCellEventArgs e)
{
    dgStation.Rows[e.RowIndex].Selected = true;
    int id = Convert.ToInt32(dgStation.Rows[e.RowIndex].Cells[1].Value.ToString());
}
  • 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-06-09T17:07:14+00:00Added an answer on June 9, 2026 at 5:07 pm

    You can attach the wire handler after the form is loaded, something like this:

    protected override void OnShown(EventArgs e) {
      base.OnShown(e);
      dgStation.RowEnter += dgStation_RowEnter;
    }
    

    Make sure to remove the current RowEnter handler from the designer file.

    Or just use a loading flag:

    private bool loading = true;
    
    protected override void OnShown(EventArgs e) {
      base.OnShown(e);
      loading = false;
    }
    
    private void dgStation_RowEnter(object sender, DataGridViewCellEventArgs e) {
      if (!loading) {
        dgStation.Rows[e.RowIndex].Selected = true;
        int id = Convert.ToInt32(dgStation.Rows[e.RowIndex].Cells[1].Value.ToString());
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In ExtJs we have a page load event named Ext.onReady() which is called after
Are ajax requests more resource-intensive than a normal page load? For example, I have
I have a html page in which i need to add more than 1
how to call more than one method at same time in my page load
I have a page on which I must load controls dynamically based on the
On page load I'm bootstrapping my data to my collections via this technique .
Is Page.Load the earliest point in the Page.Load life cycle to add Response.AppendHeader?
In my Page_Load I identify the page header block from my master page and
Q1) On page load is it possible with Jquery to check the file name
In my page load, am I calling ReturnStuff() once or three times? If I

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.