+ Start a Discussion
Santosh KumbarSantosh Kumbar 

Unable to complete the requested data change: SOME ONE HELP ME !!!

santosh kumbar

I am getting This error from since long time ; It comes all of sudden..

What Is the mistake  I AM DOING HERE

***************VF**********************************
<apex:page  controller="wrapperClassController">
    <apex:form >
        <apex:pageBlock >
            <apex:outputLabel value="Enter Text"> <apex:inputText label="Search Leads" value="{!searchText}"/></apex:outputLabel>
            <apex:commandButton action="{!Search}" value="Search"/>
                        <apex:pageBlockTable value="{!Leads}" var="c" id="table">
                <apex:column >
                    <apex:inputCheckbox value="{!c.selected}"/>
                </apex:column>
                <apex:column value="{!c.con.Name}" />
                <apex:column value="{!c.con.Email}" />
                <apex:column value="{!c.con.Phone}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>


***************************************************

*****************Controller**********************
public class wrapperClassController {

    //Our collection of the class/wrapper objects LeadWrapper
    public List<LeadWrapper> leadList {get; set;}
    
    public String searchText {get; set;}
    public List<Lead> searchList;


    public List<LeadWrapper> getLeads() {
        if(leadList == null) {
            leadList = new List<LeadWrapper>();
            String qry = 'select id, Name, Email,Street,Phone from lead where name LIKE \'%'+searchText+'%\' OR Email LIKE \'%'+searchText+'%\'  order by name';
            searchList = Database.query(qry);
            for(Lead c : searchList ) {
                
                leadList.add(new LeadWrapper(c));
            }
        }
        return leadList;
    }

    public PageReference Search(){
        getLeads();
        return null;
    }


    
    public class LeadWrapper {
        public Lead con {get; set;}
        public Boolean selected {get; set;}

        public LeadWrapper(Lead c) {
            con = c;
            selected = false;
        }
    }
}
**************************************************

Best Answer chosen by Admin (Salesforce Developers) 
Santosh KumbarSantosh Kumbar

Guys!!! Salesforce is CRazzy.......The same code i pasted in another page and controller and with no change [Addedd one by on method the page] ..It saved properly n gives the result what i wanted

Regards
Santosh