3

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.

1
  • 1
    do you have a database in the background that you can use to store what fields should currently be shown on the page? doesn't matter a whole lot but can make editing what fields show up easier than manually writing XML Commented Apr 16, 2013 at 19:10

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

2 Comments

that is fine..my question is where should i store the UI information ? in a XML ? what is the best way to do it ?
I've stored it in data tables before, I suppose it depends on what controls the dynamic nature of the UI elements. If its controlled by site administrators, you could store it to a database. XML is fine, and if you choose XML then you could adopt an XSLT approach for converting your XML into html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.