locked
how to create list of buttons with different click evnet in each button RRS feed

  • Question

  • hey guys , can some1 help me in this code ?! 

    i would like to make table in C# by code ... and in each row i want to create button ... look ...

     

    while (result.Read())

                {

                    TableRow tr = new TableRow();

                    TableCell td_userID = new TableCell();

                    TableCell td_userEmail = new TableCell();

                    TableCell td_userTitle = new TableCell();

                    TableCell td_userPrefix = new TableCell(); td_userPrefix.Width = 20;

                    TableCell td_userResume = new TableCell();

     

                    td_userID.Text = result["UserID"].ToString();

                    td_userPrefix.Text = result["UserPrefix"].ToString();

                    td_userTitle.Text = result["UserTitle"].ToString();

                    td_userEmail.Text = result["UserEmailAddress"].ToString();

                 //   HyperLink resume = new HyperLink();

                 //   resume.Text = "Click Here"; resume.NavigateUrl = "ShowResume.aspx?UserID=" + result["UserID"].ToString();

                 //   resume.ForeColor = Color.FromName("#003366");

                    Button btn_info = new Button();

    what should i type here ?!?!

    td_userResume.Controls.Add(btn_info);

     

     

                    tr.Cells.Add(td_userID);

                    tr.Cells.Add(td_userPrefix);

                    tr.Cells.Add(td_userTitle);

                    tr.Cells.Add(td_userEmail);

                    tr.Cells.Add(td_userResume);

     

                    Table1.Rows.Add(tr);

     

                }

     

     

    now , when i press any button i want to do something in the database by the information in each row ... like UserID , i want to delete UserID which exist in first row from the database by pressing the button in first row ....

    see the Hyperlink , i want to do something like that with Buttons , but !! no NavigateUrl in this situation to be saved in each button !!  i don't want to open new page to write the delelte code in it ! i want to make it in short way ...

    Saturday, March 12, 2011 10:15 PM