Skip to main content
How to pass the id from visualforce page when i click the preview button

When i click on the preview button the id of the associated record id should get passed to the controller. Its urgent
12 answers
  1. Jun 16, 2016, 6:41 AM

    Try below page code.

    <apex:page standardController="FeedbackMain__c" extensions="FeedbackMainlistController">

    <apex:form >

    <apex:pageBlock id="pg">

    <apex:pageMessages />

    <apex:pageBlockTable value="{!feed}" var="a" rowClasses="oddrow,evenrow,dataTableRow" styleClass="fontfamily" id="Details1" style="width:50%;">

    <apex:column headerValue="Feedback Number" style="width:10%;">

    <apex:outputField value="{!a.Name}" id="test" />

    <apex:variable var="vara" value="{!a.Name}" />

    </apex:column>

    <apex:column headerValue="Feedback Preview" style="width:45%;" >

    <apex:commandButton value="Preview" style="width:35%;" >

    <apex:actionSupport action="{!queslist}" event="onclick" reRender="pb">

    <apex:param assignTo="{!selectedId}" value="{!a.id}" name="selectedId"/>

    </apex:actionsupport>

    </apex:commandButton>

    </apex:column>

    </apex:pageBlockTable>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

    Also put System.debug to print selectedid in controller before you assing value into it from request parameter.
0/9000