+ Start a Discussion
KPGUPTAKPGUPTA 

how to save the data of grid view in different id's????

hello 

Can anybody help me regarding this topic..

actualy i want to dispaly my record in matrix form and want to save this... i do the displaying part but i have a problem while saving.

my code  is

=======================================apex classs============================

 

public class ExaminationSetup 
{
  
  
    public void go()
    {
        citylist.clear();
        options.clear();
        activitylist.clear();
        stuMarks.clear();
        try
        {               
            class1 = examMarks.Class1__c;
            section = examMarks.Examination_Type__c;
            date1= examMarks.Date__c;
            
                examdetail = [Select ID, Student_Name__c FROM Examination_Setup__c];
                subjectlist =[SELECT SubjectId__r.Name,ClassId__c,Marks__c FROM SubjectClassRole__c WHERE (ClassId__c =:class1) AND (SubjectId__r.Name<>NULL)];
                if(class1!=null)
                { 
                    citylist = [Select Id,Name, Student_Name__c,Class_new__c FROM Student_Profile__c WHERE (Class_new__c=:class1) ORDER BY Student_Name__c ASC];
                    for(Student_Profile__c sku:citylist)
                    {
                        Examination_Setup__c sp1=new Examination_Setup__c();
                        sp1.Student_Name__c=sku.Name + ' ' + sku.Student_Name__c;
                        sp1.StudentID__c=sku.Name;
                        activitylist.add(sp1);
                    } 
                    for(SubjectClassRole__c subject : subjectlist)
                    {
                        Examination_Setup__c subjectdata=new Examination_Setup__c();
                        subjectdata.Subject__c=subject.SubjectId__r.Name;
                        subjectdata.Marks__c=subject.Marks__c;
                        subjectdata.Class1__c=subject.ClassId__c;
                        subjectdata.Student_Name__c=citylist[0].Student_Name__c;
                        system.debug('jawakaan de marksssssssssss' + subjectdata.Student_Name__c);
                        stuMarks.add(subjectdata);
                   }
               }
            }      
              public List<SelectOption> getactivitynames()    
              {        
                  return options;    
              }
              public List<Examination_Setup__c> getRecords() 
              {   
                  return activitylist;
              }
              public List<Examination_Setup__c> getSubjects() 
              {   
                  return stuMarks; 
              }
              public void setActivity(String activity)     
              {        
                  this.activity = activity;        
                  String section1=this.activity;
              }
              public String getActivity()     
              {        
                  return activity;    
              } 
 
        
         public PageReference save()
         {
         try  
         {  
            saveclass=act.Class1__c;
            saveexam=act.Examination_Type__c;
           
            insert stuMarks;
        }         
       
    }
        
}

 

 

 

=====================Visual Force page============================================

 

<table border="1" align="center">

 

    <tr>

       <td>

 

        </td>

        <apex:repeat value="{!Subjects}" id="repeat1" var="item">

        <td>

            <center><b><apex:outputField value="{!item.Subject__c}" id="theValue"/></b></center>

        </td>

        </apex:repeat>

    </tr>

    <apex:repeat value="{!Records}" id="repeat2" var="pitem">

    <tr>

        <td><center><b><apex:outputField value="{!pitem.Student_Name__c}" id="theValue"/></b></center></td>

 

        <apex:repeat value="{!Subjects}" id="repeat3" var="item">

        <td>

            <center><b><apex:inputField value="{!item.Marks__c}" id="theValue"/></b></center>

        </td>

         </apex:repeat>

     </tr>

      </apex:repeat>

 

 

</table>    

 

My objects are student profile from which i fetch student names, 2nd object is subject from where i fetch subject names and my current object is examination setup . 

 

Student name/subjects                         sub1                    sub2                           sub3..........

sname1                                      inputfield(marks)      inputfield(marks)    inputfield(marks)

sname2                                     inputfield(marks)        inputfield(marks)   inputfield(marks)

 

 

this thing which i cant do is i dnt knw how to locate the marks with suject and sname while saving 

 

 

please send me the correct code for this.....