I'm listing some controls at my web page dynamically, either I'm adding newline with Label's.
Label newLine = new Label();newLine.Text = "<br/>"; myPanel.Controls.Add(newLine);
How can I do it in a different way?
Label newLine = new Label();newLine. Text = "<br/>"; myPanel. Controls. Add(newLine);
The DynamicControl control is used by templated data-bound controls, such as FormView or ListView, to display a data field that uses ASP.NET Dynamic Data features in a custom page. You can also use a DynamicControl control in a TemplateField field of a GridView or a DetailsView control.
ASP.NET Web Forms LabelThis control is used to display textual information on the web forms. It is mainly used to create caption for the other controls like: textbox. To create label either we can write code or use the drag and drop facility of visual studio 2017.
myPanel.Controls.Add(new LiteralControl("<br />"));
I would suggest that you don't use
at all. Use CSS to display your controls. display:block on your elements will work just fine. Less messy!
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