0

In my ASP.NET 4.0 application I recieve an object called GeneralQuestions from my WCF service. I need to populate the data from the object in the below shown format.

GenearlQuestions object has the following properties

OrderId
Header
QuestionContent

QuestionType (Based on this value I have to create a Dropdown or Radiobutton or Text box)

SubQuestions ( This is a property of type class which has OrderId, Header, QuestionContent, QuestionType properties. For example Question 15)

Can somebody guide me how can I accomplish this using JQuery.

3 Answers 3

1

I would look into jQuery Template.

It 'pastes' JSON into a template, like for example, your table :).

Sign up to request clarification or add additional context in comments.

Comments

1

Another alternative which I really like is ejs templates. It has a syntax a lot more like server tags and it's a bit easier for me to use :)

Comments

1

using only jQuery, assuming you have a <div id='formContainer'> in your html:

formContainer = $('#formContainer');

row = $('<div>', {'class':'formRow'}).appendTo(formContainer);
    $('<label>', {text:'Name', for:'inputName'}).appendTo(row);
    $('<input>', {type:'text', id:'inputName'}).appendTo(row);

row = $('<div>', {'class':'formRow'}).appendTo(formContainer);
    $('<label>', {text:'Password', for:'inputPassword'}).appendTo(row);
    $('<input>', {type:'password', id:'inputPassword'}).appendTo(row);

... and so on ...

Of course, this is not an exact answer to your question, but you get the idea.

Comments

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.