function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nilanginilangi 

Error: Unable to complete the requested data change

Guys here is my vf page code:

<apex:page controller="addit" >
<apex:pageBlock title="Registration">
<apex:form >
<h1> Student Registration </h1><hr></hr>
<apex:pageBlockTable value="{!info}" var="new" id="stdid" width="100%" >
<apex:column >
       <apex:facet name="header"><b>Student Id</b></apex:facet>
{!new.Name}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Name</b></apex:facet>
{!new.name__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Date of Birth</b></apex:facet>
{!new.dob__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>College Name</b></apex:facet>
{!new.college_name__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Branch</b></apex:facet>
{!new.branch__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Year</b></apex:facet>
{!new.year__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Semester</b></apex:facet>
{!new.semester__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Roll No</b></apex:facet>
{!new.clgno__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Previous examid</b></apex:facet>
{!new.preexamid__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>10th percent</b></apex:facet>
{!new.ssc__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>12th percent</b></apex:facet>
{!new.hsc__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Emailid</b></apex:facet>
{!new.emailid__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Mobile</b></apex:facet>
{!new.phone__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Address</b></apex:facet>
{!new.address__c}
</apex:column>
<apex:column >
       <apex:facet name="header"><b>Accept/Reject</b></apex:facet>
       <a href="javascript&colon;if (window.confirm('Are you sure?')) DeleteAccount('{!new.Name}');" style="font-weight:bold">Del</a>

</apex:column>


</apex:pageBlockTable>
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel"/>
<apex:actionFunction action="{!DeleteAccount}" name="DeleteAccount" reRender="form" >
   <apex:param name="Name" value="" assignTo="{!SelectedAccountId}"/>
</apex:actionFunction>
</apex:form>
</apex:pageBlock>
</apex:page>

 

And here is my controller:

public class addit {
 public List<student__c> info { get; set; }
 
   //used to get a hold of the account record selected for deletion
   public string SelectedAccountId { get; set; }
   public addit(){
   LoadData();
   }
    public void DeleteAccount() {
         if (SelectedAccountId == null) {
      
         return;
      }
     
      // find the account record within the collection
      student__c tobeDeleted = null;
      for(student__c a : info)
       if (a.Name == SelectedAccountId) {
          tobeDeleted = a;
          break;
       }
      
      //if account record found delete it
      if (tobeDeleted != null) {
       Delete tobeDeleted;
      }
     
      //refresh the data
      LoadData();
       
    }
  private void LoadData() {
       info = [SELECT Name,name__c,dob__c,college_name__c,branch__c,year__c,semester__c,clgno__c,preexamid__c,ssc__c,hsc__c,emailid__c,phone__c,address__c FROM student__c];
   }

}

 

 

 

 

And i m getting this error since a long time

Error: Unable to complete the requested data change

Dont know wat is going wrong.Pls help....