I am adding labels to the page programmaticaly(codebehind file c#)
Label label1 = new Label();
label1.Text = "abc";
this.Page.Form.FindControl("ContentPlaceHolder1").Controls.Add(label1);
Label label2 = new Label();
label2.Text = "def";
this.Page.Form.FindControl("ContentPlaceHolder1").Controls.Add(label2);
I want to add hr and br between these labels.How to do that?
this.Page.Form.FindControl("ContentPlaceHolder1").Controls.Add("<hr/>");
doesn't work.
Label label1 = new Label();
label1.Text = "Test 1";
form1.Controls.Add(label1);
form1.Controls.Add(new Literal() { ID="row", Text="<hr/>" } );
Label label2 = new Label();
label2.Text = "Test 2";
form1.Controls.Add(label2);
Output:
Test 1
---------------------------------------------------------------------------------
Test 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With