Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Sir
I have face a problem in my project ....
the page load event is fire on gridview selectedindex change event.....
how i solve it.......
Posted
Comments
Telstra 7-May-14 7:01am    
post your code here please
DeepakMahiChauhan 7-May-14 7:03am    
protected void OnSelectedIndexChanged(object sender, EventArgs e)
{
//Accessing BoundField Column
string name = GridView1.SelectedRow.Cells[0].Text;

//Accessing TemplateField Column controls
string country = (GridView1.SelectedRow.FindControl("lblCountry") as Label).Text;

lblValues.Text = "Name: " + name + " Country: " + country;
}

1 solution

For every event of controls your page will be loaded.

Make sure your code in Page_Load method must be like this

C#
if(!IspostBack)
{
    //code
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900