In the following code, the asp does not enter the action listener (Button1_Click). Can anyone help?
protected void Project_Click(object sender, EventArgs e)
{
Courses.ActiveViewIndex = 0;
String ConnStr = ConfigurationManager.ConnectionStrings["MyRuMoR"].ToString();
SqlConnection conn = new SqlConnection(ConnStr);
conn.Open();
SqlCommand cmd = new SqlCommand("ViewProjects", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@course_code", "PHYS305");
SqlDataReader rdr = cmd.ExecuteReader();
int c = 1;
while (rdr.Read())
{
String name = rdr.GetString(rdr.GetOrdinal("name"));
int p_id = rdr.GetInt32(rdr.GetOrdinal("p_id"));
LinkButton lb = new LinkButton();
lb.ID = p_id.ToString();
lb.Text = "Project " + c + " is: " + name;
form1.Controls.Add(lb);
lb.Click += new EventHandler(this.Button1_Click);
c++;
}
conn.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("Hello");
}
Project_Click
method.