Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create dynamic UI in .net web application

Tags:

c#

asp.net

vb.net

I am creating a .Net web application. It is a form and the contents like the text, drop downs, check boxes change often so i don't want to create the markup in ascx file. I want to create them dynamically like from an xml or something like that.

Can any one please advise of what is the best method to achieve my scenario ? Can i use XAML in web application ? Thanks.

like image 886
Manish Patel Avatar asked Nov 28 '25 04:11

Manish Patel


1 Answers

if you add a runat="server" tag to your form, then you can manipulate its controls programmatically at the server-side.

 <form id="form1" runat="server"></form>

Then in your server-side code just do something like this

var lbl = new Label();
lbl.Text = "this is my label";
form1.Controls.Add(lbl);
like image 137
Crwydryn Avatar answered Nov 30 '25 16:11

Crwydryn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!