Manish Patel
Manish Patel

Reputation: 77

Create dynamic UI in .net web application

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.

Upvotes: 3

Views: 407

Answers (1)

Crwydryn
Crwydryn

Reputation: 852

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);

Upvotes: 1

Related Questions