2012-01-11 2 views
0

내 ASP.NET 4.0 응용 프로그램에서 내 WCF 서비스에서 GeneralQuestions라는 개체를 수신합니다. 아래 표시된 형식으로 개체의 데이터를 채워야합니다. GenearlQuestions 개체다이나믹하게 테이블을 만들고 JQuery를 사용하여 데이터를 표시합니다.

내가이 사용 JQuery와 작업을 수행 할 수있는 방법

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) 

누군가가 나를 인도 할 수있는 다음과 같은 속성이 있습니다.

답변

1

나는 jQuery Template을 살펴볼 것입니다.

예를 들어 테이블과 같은 템플릿에 JSON을 붙여 넣습니다.

1

내가 정말로 좋아하는 또 다른 방법은 ejs templates입니다. 그것은 서버 태그와 같은 더 많은 구문을 가지고 나를는 jQuery를 사용하여 :

1

를 사용하는 것은 당신이 당신의 HTML에 <div id='formContainer'>이 가정, 조금 더 쉽다 :이은 물론

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 ... 

귀하의 질문에 대한 정확한 대답은 아니지만 아이디어를 얻을 수 있습니다.

관련 문제