Posted on: 5/20/2011 11:55:04 AM | Views : 341

I am trying to create a dynamic LINKBUTTON in the code(C#). I need to define each button that is created a url, and data that will be sent to that page. This is why I cannot use "postbackurl" but Response.redirect.
I have tried different approaches(see code) but they do not work .Any Ideas?
foreach (Job_Student item in currentStudent) { LinkButton lb = new LinkButton(); lb.Text = blClient.GetStudentNameByStudentID(item.StudentID); // lb.PostBackUrl = "NewMessage.aspx"; //lb.Attributes.Add("target", "_blank"); lb.Click += new EventHandler(lb_Click); lb.Attributes.Add("onclick", "lb_Click"); Panel1.Controls.Add(lb); Panel1.Controls.Add(new LiteralControl("<br/>")); //Label4.Text += lb.Text; //Label4.Text += new LiteralControl("<br/>").Text; //Add line break ...

Go to the complete details ...