Home > DeveloperSection > Forums > Fire OnSelectedIndexChanged of GridView in asp.net
Chintoo Semi

Total Post:135

Points:947
Posted on    January-14-2015 10:01 PM

 ASP.Net C#  Gridview 
Ratings:


 1 Reply(s)
 645  View(s)
Rate this:

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 OnSelectedIndexChanged of grid1.

But at page load the grid2 will be empty as no row selection is made.
So I was planning of firing the row selection of grid1 using c# code so that both grids will be having data at page load.

I have started coding like.

            grid1.DataSource = versions.DefaultView;

            grid1.SelectedIndex = 0;

            grid1.DataBind();

But the event is not firing. Can anyone help me in solving this issue?

 



john rob

Total Post:108

Points:756
Posted on    January-14-2015 10:34 PM

You can just call the method programmatically.

grid1.DataSource = versions.DefaultView;

grid1.SelectedIndex = 0;

grid1.DataBind();

 

grid1_SelectedIndexChanged(grid1, new EventArgs());


Don't want to miss updates? Please click the below button!

Follow MindStick