You need to sign in to do that
Don't have an account?
Josh Gruberman 12
Unknown Property on Custom Controller
I'm brand new to classes and controllers so I'm sure this is an easy fix but I'm getting an error of "Unknown property 'InventoryController.Inventory__c". I'm just trying to start with some simple code to make sure I know what I'm doing - clearly I don't :) I started with a Snippet from the VF Dev Guide. Anyone give me a hand with this?
Apex Class
Visualforce Page
Apex Class
public class InventoryController { private final Inventory__c inventory; public InventoryController() { Inventory = [SELECT Id, Name, Year__c, Make__c, Model__c, Description__c, Price__c FROM Inventory__c WHERE Id = :ApexPages.currentPage().getParameters().get('id')]; } public Inventory__c getInventory() { return inventory; } public PageReference save() { update inventory; return null; } }
Visualforce Page
<apex:page controller="InventoryController" sidebar="false" showHeader="false"> <apex:form> <apex:pageBlock> Year: <apex:inputField value="{!Inventory__c.Year__c}"/> Make: <apex:inputField value="{!Inventory__c.Make__c}"/> Model: <apex:inputField value="{!Inventory__c.Model__c}"/> <apex:commandButton action="{!save}" value="save"/> </apex:pageBlock> </apex:form> </apex:page>
eg: {!inventory.Year__c]
Please mark this as Best Answer if it helps!