简体   繁体   English

需要在控制器中编写的查询中在 vf 页面中显示 Fileds

[英]Need to display Fileds in vf page from Query written in Controller

I have a requirement where i need to display fields fetched from query in controller to Vf page without using pageblockTable.我有一个要求,我需要在不使用 pageblockTable 的情况下将控制器中的查询中获取的字段显示到 Vf 页面。

Please see the below code that i am trying.请查看我正在尝试的以下代码。

Apex code :顶点代码:

public class ViewDetailscontroller

{ {

public List<Course__c> coursesList{get; set;}
public Course__c coursesobj{get; set;}

  public ViewDetailscontroller()

           {

coursesobj =[SELECT Id,Answer_1__c,Web_Score_SwU__c FROM Course__c where Lead__c =: Leadid ];
} 

} }

Vf page:音频页面:

 <apex:page standardController="Lead"  extensions="ViewDetailscontroller" tabStyle="Course__c">

    <apex:form>
      <apex:pageBlock rendered="{!intrestedinData_Analytics}" >
                    <apex:pageBlockSection >

                    <apex:outputField value="{!coursesobj.Batch_for_DA__c}"/>

                    </apex:pageBlockSection>
                    </apex:pageBlock>
    </apex:form>

    </apex:page>

Problem here is i cant bind list values from Controller to pageblock tag or anyother tag apart from pageblocktable.这里的问题是我无法将 Controller 中的列表值绑定到 pageblock 标签或除 pageblocktable 之外的任何其他标签。

Please suggest,thanks.请建议,谢谢。

You can use the apex:repeat tag and build your own "table" if you like.如果您愿意,您可以使用apex:repeat标签并构建您自己的“表格”。

<apex:repeat value="{!accounts}" var="a">
        <p>{!a.name}, {!a.id}</p>                
</apex:repeat>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM