Anele Ngqandu

Anele Ngqandu

  • NA
  • 19
  • 38.6k

Execute an event when a specific button inside a gridview is clicked

Oct 14 2011 3:34 PM
Hi
 
I have a list of buttons inside my gridview cells, now i need each button to execute a difrent event when its clicked. how can i solve this?
 
I tried to put this on Page_Load but not working
 
foreach (GridViewRow rowItem in GridView1.Rows)
                        {
Button btnMonday = (Button)(GridView1.Rows[0].Cells[1].FindControl("btnMonday"));
            btnMonday.Click += new EventHandler(this.mondae_Click);
 
Button btnTuesday = (Button)(GridView1.Rows[0].Cells[2].FindControl("btnMonday"));
            btnTuesday .Click += new EventHandler(this.mondae_Click);
 
                        }
 
What should i do or where should i put it??

Answers (2)