---
title: "Fire OnSelectedIndexChanged of GridView in asp.net"  
description: "Fire OnSelectedIndexChanged of GridView in asp.net"  
author: "Anonymous User"  
published: 2015-01-14  
updated: 2015-01-14  
canonical: https://www.mindstick.com/forum/12855/fire-onselectedindexchanged-of-gridview-in-asp-dot-net  
category: "asp.net"  
tags: ["c#", "gridview"]  
reading_time: 1 minute  

---

# Fire OnSelectedIndexChanged of GridView in asp.net

I have 2 grids, grid1 and grid2.

grid2 will be filled based on which row is clicked in grid1. I have done it by [binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) OnSelectedIndexChanged of grid1.

But at [page load](https://www.mindstick.com/articles/12909/how-to-open-first-time-popup-on-page-load-in-website) the grid2 will be empty as no row [selection](https://www.mindstick.com/blog/60/populate-records-in-second-listbox-according-to-the-selection-in-first-list-box) is made.\
So I was [planning](https://answers.mindstick.com/qa/32060/who-is-the-chairman-of-planning-commissison) of firing the row selection of grid1 using [c# code](https://www.mindstick.com/forum/403/how-to-export-data-in-excel-file-from-sql-server-using-c-sharp-code) so that both grids will be having data at page load.

I have started [coding](https://www.mindstick.com/articles/12290/teaching-coding-from-the-metal-up-or-from-the-glass-back) like.

```
            grid1.DataSource = versions.DefaultView;            grid1.SelectedIndex = 0;            grid1.DataBind();
```

But the [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) is not firing. Can [anyone help me](https://www.mindstick.com/forum/331/can-anyone-help-me-out-how-to-use-session-concept) in solving this issue?

## Replies

### Reply by Anonymous User

You can just call the method programmatically.

```
grid1.DataSource = versions.DefaultView;grid1.SelectedIndex = 0;grid1.DataBind(); grid1_SelectedIndexChanged(grid1, new EventArgs());
```


---

Original Source: https://www.mindstick.com/forum/12855/fire-onselectedindexchanged-of-gridview-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
