+ Start a Discussion
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari 

The values in the commandlink are not displaying on vf page...why?

<apex:pageblocktable value="{!students}" var="student">
                      <apex:column >
                          <apex:facet name="Header">
                              <apex:commandlink value="Name" action="{!toggleSort}" reRender="block2">
                              <apex:param name="sortField" value="name" assignTo="{!sortField}"/>
                              </apex:commandlink>
                          </apex:facet>
                          <apex:outputText value="{!student.name}"/>
                      </apex:column>
                      <apex:column >
                          <apex:facet name="Header">
                              <apex:commandlink value="Id" action="{!toggleSort}" reRender="block2">
                              <apex:param name="sortField" value="studentId" assignTo="{!sortField}"/>
                              </apex:commandlink>
                          </apex:facet>
                          <apex:outputText value="{!student.Student_ID__c}"/>
                      </apex:column>
</apex:pageblocktable>
Best Answer chosen by Venkata Sravan Kumar Bandari
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari
<apex:pageblocktable value="{!students}" var="student">
                      <apex:column >
                          <apex:facet name="header">
                              <apex:commandLink action="{!toggleSort}" value="Name" rerender="block2">
                              <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                              </apex:commandLink>
                          </apex:facet>
                          <apex:outputText value="{!student.Name}" />
                      </apex:column>
                      <apex:column >
                          <apex:facet name="header">
                              <apex:commandLink action="{!toggleSort}" value="Id" rerender="block2">
                              <apex:param name="sortField" value="student_id__c" assignTo="{!sortField}"/>
                              </apex:commandLink>
                          </apex:facet>
                          <apex:outputText value="{!student.Student_ID__c}" />
                      </apex:column>

Thank u i got the solution

All Answers

Pritam ShekhawatPritam Shekhawat
Hello Venkata,
                     Try this code hope its works fine.
<apex:pageblocktable value="{!students}" var="student">
                      <apex:column >
                          <apex:facet name="Header">
                              <apex:commandlink value="Name" action="{!toggleSort}" reRender="block2">
                              <apex:param name="sortField" value="name" assignTo="{!sortField}"/>
                              </apex:commandlink>
                          </apex:facet>
                          <apex:outputLink value="/{!student.id}" target="_blank">{!student.Name}</apex:outputLink>
                      </apex:column>
                      <apex:column >
                          <apex:facet name="Header">
                              <apex:commandlink value="Id" action="{!toggleSort}" reRender="block2">
                              <apex:param name="sortField" value="studentId" assignTo="{!sortField}"/>
                              </apex:commandlink>
                          </apex:facet>
        <apex:outputLink value="{!student.Student_ID__c}"target="_blank">{!student.Student_ID__c}/></apex:outputLink>
                      </apex:column>
</apex:pageblocktable>
Thanx
Pritam Shekhawat
 
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari
Thank you mr. pritam, but my requirement is i want to display the column header as commandlink not the data of the column
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari
<apex:pageblocktable value="{!students}" var="student">
                      <apex:column >
                          <apex:facet name="header">
                              <apex:commandLink action="{!toggleSort}" value="Name" rerender="block2">
                              <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                              </apex:commandLink>
                          </apex:facet>
                          <apex:outputText value="{!student.Name}" />
                      </apex:column>
                      <apex:column >
                          <apex:facet name="header">
                              <apex:commandLink action="{!toggleSort}" value="Id" rerender="block2">
                              <apex:param name="sortField" value="student_id__c" assignTo="{!sortField}"/>
                              </apex:commandLink>
                          </apex:facet>
                          <apex:outputText value="{!student.Student_ID__c}" />
                      </apex:column>

Thank u i got the solution
This was selected as the best answer
Pritam ShekhawatPritam Shekhawat
ok cheers !!
Thanx
Pritam Shekhawat