質問

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