+ Start a Discussion
Vijay sidaraddiVijay sidaraddi 

Suggest me where im wrong in this apex class

hi can someone suggest me where im wrong in this class as i couldnt able to save it.

public class ExportasPDF {
 public static Integer AssignmentNumber
    public ExportasPDF() {
        AssignmentNumber = [SELECT AssignmentNumber, AFE FROM AssignmentPackage
                   WHERE AssignmentNumber = :ApexPages.currentPage().getParameters().get('AssignmentNumber')];
    }

 
    public AssignmentPackage getAssignmentNumber() {
        return assignmentPackage;
    }

    public PageReference ExportasPDF() {
        update AssignmentNumber;
        return null;
    }
}




*********Vf page 

<apex:page controller="ExportasPDF" tabStyle="AssignmentPackage">
    <apex:form>
        <apex:pageBlock title="New assignment package {!$User.Assignment Number}">
             belong to Assignment AFE: <apex:inputField value="{!Assignment.AFE}"/>

            <apex:commandButton action="{!ExportasPDF}" value="ExportasPDF"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Thanks
Vijaykumar S
Best Answer chosen by Vijay sidaraddi
karthikeyan perumalkarthikeyan perumal
Hello

Use blow updated class... 
 
public class ExportasPDFTOSave {
 public  List<AssignmentPackage> lstAssignment {get;set;}
    public ExportasPDFTOSave() {
        lstAssignment = [SELECT AssignmentNumber, AFE FROM AssignmentPackage
                   WHERE AssignmentNumber = :ApexPages.currentPage().getParameters().get('Id')];
    }

 
    public List<AssignmentPackage> getAssignmentNumber() {
        return lstAssignment;
    }

    public PageReference ExportasPDF() {
        update lstAssignment;
        return null;
    }
}
 
<apex:page controller="ExportasPDFTOSave" tabStyle="AssignmentPackage">
    <apex:form>
        <apex:pageBlock title="New assignment package {!$User.AssignmentNumber}">
             belong to Assignment AFE: <apex:inputField value="{!Assignment.AFE}"/>

            <apex:commandButton action="{!ExportasPDF}" value="ExportasPDF"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Hope this will help you.. 

Thanks
karthik
 

All Answers

karthikeyan perumalkarthikeyan perumal
Hello

Use blow updated class... 
 
public class ExportasPDFTOSave {
 public  List<AssignmentPackage> lstAssignment {get;set;}
    public ExportasPDFTOSave() {
        lstAssignment = [SELECT AssignmentNumber, AFE FROM AssignmentPackage
                   WHERE AssignmentNumber = :ApexPages.currentPage().getParameters().get('Id')];
    }

 
    public List<AssignmentPackage> getAssignmentNumber() {
        return lstAssignment;
    }

    public PageReference ExportasPDF() {
        update lstAssignment;
        return null;
    }
}
 
<apex:page controller="ExportasPDFTOSave" tabStyle="AssignmentPackage">
    <apex:form>
        <apex:pageBlock title="New assignment package {!$User.AssignmentNumber}">
             belong to Assignment AFE: <apex:inputField value="{!Assignment.AFE}"/>

            <apex:commandButton action="{!ExportasPDF}" value="ExportasPDF"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Hope this will help you.. 

Thanks
karthik
 
This was selected as the best answer
Vijay sidaraddiVijay sidaraddi
thanks lot its working fine as expected..