문제

I created a custom Page which loads a list of Assets. I click on the Asset Name and now want to send the Asset name I clicked to my Controller so that I can do :

Asset myasset = SELECT name from Asset where name = [CLICKED ASSET NAME TEXT]

How do I pass that data to the controller.

Thank you

도움이 되었습니까?

해결책

VisualForce:

<apex:repeat value="{!theAssets}" var="asset">
  <apex:commandLink value="{!asset.Name}" action="{!someAction}">
    <apex:param name="paramName" assignTo="{!assetName}" value="{!asset.Name}" />
  </apex:commandLink>
</apex:repeat>

In the controller, make sure you define the property for the asset name:

public String AssetName { get; set; }

Elsewhere in the controller, you could have the statement:

Asset myasset = [SELECT name from Asset where name = :AssetName];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top