
' This file implements the TableControl, TableControlRow, and RecordControl classes for the 
' AddPersonalEducation.aspx page.  The Row or RecordControl classes are the 
' ideal place to add code customizations. For example, you can override the LoadData, 
' CreateWhereClause, DataBind, SaveData, GetUIData, and Validate methods.

#Region "Imports statements"

Option Strict On
Imports Microsoft.VisualBasic
Imports BaseClasses.Web.UI.WebControls
Imports System
Imports System.Collections
Imports System.Collections.Generic
        
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports BaseClasses
Imports BaseClasses.Data
Imports BaseClasses.Utils
Imports ReportTools.ReportCreator
Imports ReportTools.Shared

  
        
Imports Persons.Business
Imports Persons.Data
        

#End Region

  
Namespace Persons.UI.Controls.AddPersonalEducation

#Region "Section 1: Place your customizations here."

    
Public Class PersonalEducationRecordControl
        Inherits BasePersonalEducationRecordControl
        ' The BasePersonalEducationRecordControl implements the LoadData, DataBind and other
        ' methods to load and display the data in a table control.

        ' This is the ideal place to add your code customizations. For example, you can override the LoadData, 
        ' CreateWhereClause, DataBind, SaveData, GetUIData, and Validate methods.
        

End Class

  

#End Region

  

#Region "Section 2: Do not modify this section."
    
    
' Base class for the PersonalEducationRecordControl control on the AddPersonalEducation page.
' Do not modify this class. Instead override any method in PersonalEducationRecordControl.
Public Class BasePersonalEducationRecordControl
        Inherits Persons.UI.BaseApplicationRecordControl

        '  To customize, override this method in PersonalEducationRecordControl.
        Protected Overridable Sub Control_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init
      
            ' Setup the filter and search events.
            
            Me.ClearControlsFromSession()
        End Sub

        '  To customize, override this method in PersonalEducationRecordControl.
        Protected Overridable Sub Control_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
              ' Setup the pagination events.	  
                     
        
              ' Register the event handlers.
          
              Me.PersonalIdAddRecordLink.PostBackUrl = "../PersonalId/AddPersonalId.aspx" & "?Target=" & Me.PersonalId.ClientID & "&DFKA=" & HttpUtility.UrlEncode("PersonalName")
              Me.PersonalIdAddRecordLink.Attributes.Item("onClick") = "window.open('" & Me.PersonalIdAddRecordLink.PostBackUrl & "','_blank', 'width=900, height=700, resizable, scrollbars, modal=yes'); return false;"
              
              AddHandler Me.COUNTRY.SelectedIndexChanged, AddressOf COUNTRY_SelectedIndexChanged
            
              AddHandler Me.LevelId.SelectedIndexChanged, AddressOf LevelId_SelectedIndexChanged
            
              AddHandler Me.PersonalId.SelectedIndexChanged, AddressOf PersonalId_SelectedIndexChanged
            
              AddHandler Me.Command.TextChanged, AddressOf Command_TextChanged
            
              AddHandler Me.CommandDate.TextChanged, AddressOf CommandDate_TextChanged
            
              AddHandler Me.Course.TextChanged, AddressOf Course_TextChanged
            
              AddHandler Me.CourseAbbr.TextChanged, AddressOf CourseAbbr_TextChanged
            
              AddHandler Me.CourseNo.TextChanged, AddressOf CourseNo_TextChanged
            
              AddHandler Me.EducationPeriod.TextChanged, AddressOf EducationPeriod_TextChanged
            
              AddHandler Me.EducationType.TextChanged, AddressOf EducationType_TextChanged
            
              AddHandler Me.EdYear.TextChanged, AddressOf EdYear_TextChanged
            
              AddHandler Me.EndDate.TextChanged, AddressOf EndDate_TextChanged
            
              AddHandler Me.Facultry.TextChanged, AddressOf Facultry_TextChanged
            
              AddHandler Me.Institue.TextChanged, AddressOf Institue_TextChanged
            
              AddHandler Me.NoAll.TextChanged, AddressOf NoAll_TextChanged
            
              AddHandler Me.Score.TextChanged, AddressOf Score_TextChanged
            
              AddHandler Me.ScoreNo.TextChanged, AddressOf ScoreNo_TextChanged
            
              AddHandler Me.StartDate.TextChanged, AddressOf StartDate_TextChanged
            
    
        End Sub

        
        Public Overridable Sub LoadData()        
                
            ' Load the data from the database into the DataSource PersonalEducation record.
            ' It is better to make changes to functions called by LoadData such as
            ' CreateWhereClause, rather than making changes here.
    
            ' The RecordUniqueId is set the first time a record is loaded, and is
            ' used during a PostBack to load the record.
          
            If Me.RecordUniqueId IsNot Nothing AndAlso Me.RecordUniqueId.Trim <> "" Then
                Me.DataSource = PersonalEducationTable.GetRecord(Me.RecordUniqueId, True)
          
                Return
            End If
        
            ' This is the first time a record is being retrieved from the database.
            ' So create a Where Clause based on the staic Where clause specified
            ' on the Query wizard and the dynamic part specified by the end user
            ' on the search and filter controls (if any).
            
            Dim wc As WhereClause = Me.CreateWhereClause()
          
            ' If there is no Where clause, then simply create a new, blank record.
             
            If wc Is Nothing OrElse Not wc.RunQuery Then
                Me.DataSource = New PersonalEducationRecord()
            
                Return
            End If
          
            ' Retrieve the record from the database.  It is possible
            
            Dim recList() As PersonalEducationRecord = PersonalEducationTable.GetRecords(wc, Nothing, 0, 2)
            If recList.Length = 0 Then
                ' There is no data for this Where clause.
                wc.RunQuery = False
                
                Return
            End If
            
            ' Set DataSource based on record retrieved from the database.
            Me.DataSource = CType(PersonalEducationRecord.Copy(recList(0), False), PersonalEducationRecord)
                  
    
    
        End Sub

        ' Populate the UI controls using the DataSource.  To customize, override this method in PersonalEducationRecordControl.
        Public Overrides Sub DataBind()
            ' The DataBind method binds the user interface controls to the values
            ' from the database record.  To do this, it calls the Set methods for 
            ' each of the field displayed on the webpage.  It is better to make 
            ' changes in the Set methods, rather than making changes here.
            
            MyBase.DataBind()

            ' Make sure that the DataSource is initialized.
            If Me.DataSource Is Nothing Then
    
                Return
            End If
            
    
            'LoadData for DataSource for chart and report if they exist
          
      
      
            ' Call the Set methods for each controls on the panel
        
                SetCommand()
                SetCommandDate()
                SetCommandDateLabel()
                SetCommandLabel()
                SetCOUNTRY()
                SetCOUNTRYLabel()
                SetCourse()
                SetCourseAbbr()
                SetCourseAbbrLabel()
                SetCourseLabel()
                SetCourseNo()
                SetCourseNoLabel()
                SetEducationPeriod()
                SetEducationPeriodLabel()
                SetEducationType()
                SetEducationTypeLabel()
                SetEdYear()
                SetEdYearLabel()
                SetEndDate()
                SetEndDateLabel()
                SetFacultry()
                SetFacultryLabel()
                SetInstitue()
                SetInstitueLabel()
                SetLevelId()
                SetLevelIdLabel()
                SetNoAll()
                SetNoAllLabel()
                SetPersonalEducationRecordControlCollapsibleRegion()
                SetPersonalEducationRecordControlIcon()
                SetPersonalEducationRecordControlPanelExtender()
                
                SetPersonalId()
                
                SetPersonalIdLabel()
                SetScore()
                SetScoreLabel()
                SetScoreNo()
                SetScoreNoLabel()
                SetStartDate()
                SetStartDateLabel()
      
      
            Me.IsNewRecord = True
            
            If Me.DataSource.IsCreated Then
                Me.IsNewRecord = False
                
                Me.RecordUniqueId = Me.DataSource.GetID.ToXmlString()
            End If
          
            ' Now load data for each record and table child UI controls.
            ' Ordering is important because child controls get 
            ' their parent ids from their parent UI controls.
            Dim shouldResetControl As Boolean = False
                  
        End Sub
        
        
        Public Overridable Sub SetCommand()
            
        
            ' Set the Command TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.Command is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetCommand()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandSpecified Then
                				
                ' If the Command is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Command)
                              
                Me.Command.Text = formattedValue
                
            Else 
            
                ' Command is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.Command.Text = PersonalEducationTable.Command.Format(PersonalEducationTable.Command.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetCommandDate()
            
        
            ' Set the CommandDate TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.CommandDate is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetCommandDate()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CommandDateSpecified Then
                				
                ' If the CommandDate is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CommandDate, "d MMM yy")
                              
                Me.CommandDate.Text = formattedValue
                
            Else 
            
                ' CommandDate is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.CommandDate.Text = PersonalEducationTable.CommandDate.Format(PersonalEducationTable.CommandDate.DefaultValue, "d MMM yy")
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetCOUNTRY()
            
        
            ' Set the COUNTRY DropDownList on the webpage with value from the
            ' PersonalEducation database record.
            
            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.COUNTRY is the ASP:DropDownList on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetCOUNTRY()
            ' and add your own code before or after the call to the MyBase function.

            
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.COUNTRYSpecified Then
                            
                ' If the COUNTRY is non-NULL, then format the value.
                ' The Format method will return the Display Foreign Key As (DFKA) value
                Me.PopulateCOUNTRYDropDownList(Me.DataSource.COUNTRY.ToString(), 100)
                
            Else
                
                ' COUNTRY is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
                If Me.DataSource IsNot Nothing AndAlso Me.DataSource.IsCreated Then
                    Me.PopulateCOUNTRYDropDownList(Nothing, 100)
                Else
                    Me.PopulateCOUNTRYDropDownList(PersonalEducationTable.COUNTRY.DefaultValue, 100)
                End If
                				
            End If			
                
        End Sub
                
        Public Overridable Sub SetCourse()
            
        
            ' Set the Course TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.Course is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetCourse()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseSpecified Then
                				
                ' If the Course is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Course)
                              
                Me.Course.Text = formattedValue
                
            Else 
            
                ' Course is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.Course.Text = PersonalEducationTable.Course.Format(PersonalEducationTable.Course.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetCourseAbbr()
            
        
            ' Set the CourseAbbr TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.CourseAbbr is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetCourseAbbr()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseAbbrSpecified Then
                				
                ' If the CourseAbbr is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseAbbr)
                              
                Me.CourseAbbr.Text = formattedValue
                
            Else 
            
                ' CourseAbbr is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.CourseAbbr.Text = PersonalEducationTable.CourseAbbr.Format(PersonalEducationTable.CourseAbbr.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetCourseNo()
            
        
            ' Set the CourseNo TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.CourseNo is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetCourseNo()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.CourseNoSpecified Then
                				
                ' If the CourseNo is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.CourseNo)
                              
                Me.CourseNo.Text = formattedValue
                
            Else 
            
                ' CourseNo is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.CourseNo.Text = PersonalEducationTable.CourseNo.Format(PersonalEducationTable.CourseNo.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetEducationPeriod()
            
        
            ' Set the EducationPeriod TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.EducationPeriod is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetEducationPeriod()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationPeriodSpecified Then
                				
                ' If the EducationPeriod is non-NULL, then format the value.

                ' The Format method will return the Display Foreign Key As (DFKA) value
                                Dim formattedValue As String = Me.DataSource.EducationPeriod.ToString()
                                
                            
                Me.EducationPeriod.Text = formattedValue
                
            Else 
            
                ' EducationPeriod is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.EducationPeriod.Text = PersonalEducationTable.EducationPeriod.DefaultValue		
                End If
                 
        End Sub
                
        Public Overridable Sub SetEducationType()
            
        
            ' Set the EducationType TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.EducationType is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetEducationType()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EducationTypeSpecified Then
                				
                ' If the EducationType is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EducationType)
                              
                Me.EducationType.Text = formattedValue
                
            Else 
            
                ' EducationType is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.EducationType.Text = PersonalEducationTable.EducationType.Format(PersonalEducationTable.EducationType.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetEdYear()
            
        
            ' Set the EdYear TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.EdYear is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetEdYear()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EdYearSpecified Then
                				
                ' If the EdYear is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EdYear)
                              
                Me.EdYear.Text = formattedValue
                
            Else 
            
                ' EdYear is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.EdYear.Text = PersonalEducationTable.EdYear.Format(PersonalEducationTable.EdYear.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetEndDate()
            
        
            ' Set the EndDate TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.EndDate is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetEndDate()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.EndDateSpecified Then
                				
                ' If the EndDate is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.EndDate, "d MMM yy")
                              
                Me.EndDate.Text = formattedValue
                
            Else 
            
                ' EndDate is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.EndDate.Text = PersonalEducationTable.EndDate.Format(PersonalEducationTable.EndDate.DefaultValue, "d MMM yy")
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetFacultry()
            
        
            ' Set the Facultry TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.Facultry is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetFacultry()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.FacultrySpecified Then
                				
                ' If the Facultry is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Facultry)
                              
                Me.Facultry.Text = formattedValue
                
            Else 
            
                ' Facultry is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.Facultry.Text = PersonalEducationTable.Facultry.Format(PersonalEducationTable.Facultry.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetInstitue()
            
        
            ' Set the Institue TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.Institue is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetInstitue()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.InstitueSpecified Then
                				
                ' If the Institue is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Institue)
                              
                Me.Institue.Text = formattedValue
                
            Else 
            
                ' Institue is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.Institue.Text = PersonalEducationTable.Institue.Format(PersonalEducationTable.Institue.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetLevelId()
            
        
            ' Set the LevelId DropDownList on the webpage with value from the
            ' PersonalEducation database record.
            
            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.LevelId is the ASP:DropDownList on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetLevelId()
            ' and add your own code before or after the call to the MyBase function.

            
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.LevelIdSpecified Then
                            
                ' If the LevelId is non-NULL, then format the value.
                ' The Format method will return the Display Foreign Key As (DFKA) value
                Me.PopulateLevelIdDropDownList(Me.DataSource.LevelId.ToString(), 100)
                
            Else
                
                ' LevelId is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
                If Me.DataSource IsNot Nothing AndAlso Me.DataSource.IsCreated Then
                    Me.PopulateLevelIdDropDownList(Nothing, 100)
                Else
                    Me.PopulateLevelIdDropDownList(PersonalEducationTable.LevelId.DefaultValue, 100)
                End If
                				
            End If			
                
        End Sub
                
        Public Overridable Sub SetNoAll()
            
        
            ' Set the NoAll TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.NoAll is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetNoAll()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.NoAllSpecified Then
                				
                ' If the NoAll is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.NoAll)
                              
                Me.NoAll.Text = formattedValue
                
            Else 
            
                ' NoAll is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.NoAll.Text = PersonalEducationTable.NoAll.Format(PersonalEducationTable.NoAll.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetPersonalId()
            
        
            ' Set the PersonalId DropDownList on the webpage with value from the
            ' PersonalEducation database record.
            
            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.PersonalId is the ASP:DropDownList on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetPersonalId()
            ' and add your own code before or after the call to the MyBase function.

            
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.PersonalIdSpecified Then
                            
                ' If the PersonalId is non-NULL, then format the value.
                ' The Format method will return the Display Foreign Key As (DFKA) value
                Me.PopulatePersonalIdDropDownList(Me.DataSource.PersonalId, 100)
                
            Else
                
                ' PersonalId is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
                If Me.DataSource IsNot Nothing AndAlso Me.DataSource.IsCreated Then
                    Me.PopulatePersonalIdDropDownList(Nothing, 100)
                Else
                    Me.PopulatePersonalIdDropDownList(PersonalEducationTable.PersonalId.DefaultValue, 100)
                End If
                				
            End If			
                
        End Sub
                
        Public Overridable Sub SetScore()
            
        
            ' Set the Score TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.Score is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetScore()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreSpecified Then
                				
                ' If the Score is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.Score)
                              
                Me.Score.Text = formattedValue
                
            Else 
            
                ' Score is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.Score.Text = PersonalEducationTable.Score.Format(PersonalEducationTable.Score.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetScoreNo()
            
        
            ' Set the ScoreNo TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.ScoreNo is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetScoreNo()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.ScoreNoSpecified Then
                				
                ' If the ScoreNo is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.ScoreNo)
                              
                Me.ScoreNo.Text = formattedValue
                
            Else 
            
                ' ScoreNo is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.ScoreNo.Text = PersonalEducationTable.ScoreNo.Format(PersonalEducationTable.ScoreNo.DefaultValue)
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetStartDate()
            
        
            ' Set the StartDate TextBox on the webpage with value from the
            ' PersonalEducation database record.

            ' Me.DataSource is the PersonalEducation record retrieved from the database.
            ' Me.StartDate is the ASP:TextBox on the webpage.
            
            ' You can modify this method directly, or replace it with a call to
            '     MyBase.SetStartDate()
            ' and add your own code before or after the call to the MyBase function.

            
                  
            If Me.DataSource IsNot Nothing AndAlso Me.DataSource.StartDateSpecified Then
                				
                ' If the StartDate is non-NULL, then format the value.

                ' The Format method will use the Display Format
                                Dim formattedValue As String = Me.DataSource.Format(PersonalEducationTable.StartDate, "d MMM yy")
                              
                Me.StartDate.Text = formattedValue
                
            Else 
            
                ' StartDate is NULL in the database, so use the Default Value.  
                ' Default Value could also be NULL.
        
                Me.StartDate.Text = PersonalEducationTable.StartDate.Format(PersonalEducationTable.StartDate.DefaultValue, "d MMM yy")
                        		
                End If
                 
        End Sub
                
        Public Overridable Sub SetCommandDateLabel()
                  
                  End Sub
                
        Public Overridable Sub SetCommandLabel()
                  
                  End Sub
                
        Public Overridable Sub SetCOUNTRYLabel()
                  
                  End Sub
                
        Public Overridable Sub SetCourseAbbrLabel()
                  
                  End Sub
                
        Public Overridable Sub SetCourseLabel()
                  
                  End Sub
                
        Public Overridable Sub SetCourseNoLabel()
                  
                  End Sub
                
        Public Overridable Sub SetEducationPeriodLabel()
                  
                  End Sub
                
        Public Overridable Sub SetEducationTypeLabel()
                  
                  End Sub
                
        Public Overridable Sub SetEdYearLabel()
                  
                  End Sub
                
        Public Overridable Sub SetEndDateLabel()
                  
                  End Sub
                
        Public Overridable Sub SetFacultryLabel()
                  
                  End Sub
                
        Public Overridable Sub SetInstitueLabel()
                  
                  End Sub
                
        Public Overridable Sub SetLevelIdLabel()
                  
                  End Sub
                
        Public Overridable Sub SetNoAllLabel()
                  
                  End Sub
                
        Public Overridable Sub SetPersonalEducationRecordControlCollapsibleRegion()
                  
                  End Sub
                
        Public Overridable Sub SetPersonalEducationRecordControlIcon()
                  
                  End Sub
                
        Public Overridable Sub SetPersonalEducationRecordControlPanelExtender()
                  
                  End Sub
                
        Public Overridable Sub SetPersonalIdLabel()
                  
                  End Sub
                
        Public Overridable Sub SetScoreLabel()
                  
                  End Sub
                
        Public Overridable Sub SetScoreNoLabel()
                  
                  End Sub
                
        Public Overridable Sub SetStartDateLabel()
                  
                  End Sub
                
        Public Overridable Sub ResetControl()
          
        End Sub
        

        Public EvaluateFormulaDelegate As BaseClasses.Data.DataSource.EvaluateFormulaDelegate = New BaseClasses.Data.DataSource.EvaluateFormulaDelegate(AddressOf Me.EvaluateFormula)

        Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean, ByVal e As FormulaEvaluator) As String
            If e Is Nothing Then
                e = New FormulaEvaluator()
            End If
            
            e.Variables.Clear()

            
            ' add variables for formula evaluation
            If variables IsNot Nothing Then
                Dim enumerator As System.Collections.Generic.IEnumerator(Of System.Collections.Generic.KeyValuePair(Of String, Object)) = variables.GetEnumerator()
                While enumerator.MoveNext()
                    e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value)
                End While
            End If

            If includeDS
                
            End IF
            
            
            ' Other variables referred to in the formula are expected to be
            ' properties of the DataSource.  For example, referring to
            ' UnitPrice as a variable will refer to DataSource.UnitPrice
            If dataSourceForEvaluate Is Nothing Then

                e.DataSource = Me.DataSource

            Else
                e.DataSource = dataSourceForEvaluate
            End If

            ' Define the calling control.  This is used to add other 
            ' related table and record controls as variables.
            e.CallingControl = Me

            Dim resultObj As Object = e.Evaluate(formula)
            If resultObj Is Nothing Then
                Return ""
            End If

            If Not String.IsNullOrEmpty(format) AndAlso (String.IsNullOrEmpty(formula) OrElse formula.IndexOf("Format(") < 0) Then
                Return FormulaUtils.Format(resultObj, format)
            Else
                Return resultObj.ToString()
            End If
        End Function      
        
        Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate as BaseClasses.Data.BaseRecord, ByVal format as String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal includeDS As Boolean) As String
            Return EvaluateFormula(formula, dataSourceForEvaluate, format,variables ,includeDS, Nothing)        
        End Function        

        
        Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object)) As String
            Return EvaluateFormula(formula, dataSourceForEvaluate, format, variables ,True, Nothing)        
        End Function        

        Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal format As String) As String
            Return Me.EvaluateFormula(formula, dataSourceForEvaluate, format, Nothing, True, Nothing)
        End Function

        Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord, ByVal variables As System.Collections.Generic.IDictionary(Of String, Object), ByVal e as FormulaEvaluator) As String
            Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, variables, True, e)
        End Function

        Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal dataSourceForEvaluate As BaseClasses.Data.BaseRecord) As String
            Return Me.EvaluateFormula(formula, dataSourceForEvaluate, Nothing, Nothing, True, Nothing)
        End Function

        Public Overridable Function EvaluateFormula(ByVal formula As String, ByVal includeDS as Boolean) As String
            Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, includeDS, Nothing)
        End Function

        Public Overridable Function EvaluateFormula(ByVal formula As String) As String
            Return Me.EvaluateFormula(formula, Nothing, Nothing, Nothing, True, Nothing)
        End Function


        Public Overridable Sub RegisterPostback()
        
        
        End Sub

      
        
        ' To customize, override this method in PersonalEducationRecordControl.
        Public Overridable Sub SaveData()
            ' Saves the associated record in the database.
            ' SaveData calls Validate and Get methods - so it may be more appropriate to
            ' customize those methods.

            ' 1. Load the existing record from the database. Since we save the entire record, this ensures 
            ' that fields that are not displayed are also properly initialized.
            Me.LoadData()
        
              
            ' 2. Perform any custom validation.
            Me.Validate()

            
            ' 3. Set the values in the record with data from UI controls.
            ' This calls the Get() method for each of the user interface controls.
            Me.GetUIData()

            ' 4. Save in the database.
            ' We should not save the record if the data did not change. This
            ' will save a database hit and avoid triggering any database triggers.
             
            If Me.DataSource.IsAnyValueChanged Then
                ' Save record to database but do not commit yet.
                ' Auto generated ids are available after saving for use by child (dependent) records.
                Me.DataSource.Save()
              
            End If
            
      
            ' update session or cookie by formula
                                    
      
            ' Setting the DataChanged to True results in the page being refreshed with
            ' the most recent data from the database.  This happens in PreRender event
            ' based on the current sort, search and filter criteria.
            Me.DataChanged = True
            Me.ResetData = True
            
            ' For Master-Detail relationships, save data on the Detail table(s)
          
        End Sub

        ' To customize, override this method in PersonalEducationRecordControl.
        Public Overridable Sub GetUIData()
            ' The GetUIData method retrieves the updated values from the user interface 
            ' controls into a database record in preparation for saving or updating.
            ' To do this, it calls the Get methods for each of the field displayed on 
            ' the webpage.  It is better to make changes in the Get methods, rather 
            ' than making changes here.
      
            ' Call the Get methods for each of the user interface controls.
        
            GetCommand()
            GetCommandDate()
            GetCOUNTRY()
            GetCourse()
            GetCourseAbbr()
            GetCourseNo()
            GetEducationPeriod()
            GetEducationType()
            GetEdYear()
            GetEndDate()
            GetFacultry()
            GetInstitue()
            GetLevelId()
            GetNoAll()
            GetPersonalId()
            GetScore()
            GetScoreNo()
            GetStartDate()
        End Sub
        
        
        Public Overridable Sub GetCommand()
            
            ' Retrieve the value entered by the user on the Command ASP:TextBox, and
            ' save it into the Command field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.Command.Text, PersonalEducationTable.Command)			

                      
        End Sub
                
        Public Overridable Sub GetCommandDate()
            
            ' Retrieve the value entered by the user on the CommandDate ASP:TextBox, and
            ' save it into the CommandDate field in DataSource PersonalEducation record.
            ' Parse will also validate the date to ensure it is of the proper format
            ' and a valid date.  The format is verified based on the current culture 
            ' settings including the order of month, day and year and the separator character.
            ' Parse throws an exception if the date is invalid.
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.CommandDate.Text, PersonalEducationTable.CommandDate)			

                      
        End Sub
                
        Public Overridable Sub GetCOUNTRY()
         
            ' Retrieve the value entered by the user on the COUNTRY ASP:DropDownList, and
            ' save it into the COUNTRY field in DataSource PersonalEducation record.
                        
            ' Custom validation should be performed in Validate, not here.
            
            Me.DataSource.Parse(GetValueSelectedPageRequest(Me.COUNTRY), PersonalEducationTable.COUNTRY)				
            
        End Sub
                
        Public Overridable Sub GetCourse()
            
            ' Retrieve the value entered by the user on the Course ASP:TextBox, and
            ' save it into the Course field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.Course.Text, PersonalEducationTable.Course)			

                      
        End Sub
                
        Public Overridable Sub GetCourseAbbr()
            
            ' Retrieve the value entered by the user on the CourseAbbr ASP:TextBox, and
            ' save it into the CourseAbbr field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.CourseAbbr.Text, PersonalEducationTable.CourseAbbr)			

                      
        End Sub
                
        Public Overridable Sub GetCourseNo()
            
            ' Retrieve the value entered by the user on the CourseNo ASP:TextBox, and
            ' save it into the CourseNo field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.CourseNo.Text, PersonalEducationTable.CourseNo)			

                      
        End Sub
                
        Public Overridable Sub GetEducationPeriod()
            
            ' Retrieve the value entered by the user on the EducationPeriod ASP:TextBox, and
            ' save it into the EducationPeriod field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.EducationPeriod.Text, PersonalEducationTable.EducationPeriod)			

                      
        End Sub
                
        Public Overridable Sub GetEducationType()
            
            ' Retrieve the value entered by the user on the EducationType ASP:TextBox, and
            ' save it into the EducationType field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.EducationType.Text, PersonalEducationTable.EducationType)			

                      
        End Sub
                
        Public Overridable Sub GetEdYear()
            
            ' Retrieve the value entered by the user on the EdYear ASP:TextBox, and
            ' save it into the EdYear field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.EdYear.Text, PersonalEducationTable.EdYear)			

                      
        End Sub
                
        Public Overridable Sub GetEndDate()
            
            ' Retrieve the value entered by the user on the EndDate ASP:TextBox, and
            ' save it into the EndDate field in DataSource PersonalEducation record.
            ' Parse will also validate the date to ensure it is of the proper format
            ' and a valid date.  The format is verified based on the current culture 
            ' settings including the order of month, day and year and the separator character.
            ' Parse throws an exception if the date is invalid.
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.EndDate.Text, PersonalEducationTable.EndDate)			

                      
        End Sub
                
        Public Overridable Sub GetFacultry()
            
            ' Retrieve the value entered by the user on the Facultry ASP:TextBox, and
            ' save it into the Facultry field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.Facultry.Text, PersonalEducationTable.Facultry)			

                      
        End Sub
                
        Public Overridable Sub GetInstitue()
            
            ' Retrieve the value entered by the user on the Institue ASP:TextBox, and
            ' save it into the Institue field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.Institue.Text, PersonalEducationTable.Institue)			

                      
        End Sub
                
        Public Overridable Sub GetLevelId()
         
            ' Retrieve the value entered by the user on the LevelId ASP:DropDownList, and
            ' save it into the LevelId field in DataSource PersonalEducation record.
                        
            ' Custom validation should be performed in Validate, not here.
            
            Me.DataSource.Parse(GetValueSelectedPageRequest(Me.LevelId), PersonalEducationTable.LevelId)				
            
        End Sub
                
        Public Overridable Sub GetNoAll()
            
            ' Retrieve the value entered by the user on the NoAll ASP:TextBox, and
            ' save it into the NoAll field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.NoAll.Text, PersonalEducationTable.NoAll)			

                      
        End Sub
                
        Public Overridable Sub GetPersonalId()
         
            ' Retrieve the value entered by the user on the PersonalId ASP:DropDownList, and
            ' save it into the PersonalId field in DataSource PersonalEducation record.
                        
            ' Custom validation should be performed in Validate, not here.
            
            Me.DataSource.Parse(GetValueSelectedPageRequest(Me.PersonalId), PersonalEducationTable.PersonalId)				
            
        End Sub
                
        Public Overridable Sub GetScore()
            
            ' Retrieve the value entered by the user on the Score ASP:TextBox, and
            ' save it into the Score field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.Score.Text, PersonalEducationTable.Score)			

                      
        End Sub
                
        Public Overridable Sub GetScoreNo()
            
            ' Retrieve the value entered by the user on the ScoreNo ASP:TextBox, and
            ' save it into the ScoreNo field in DataSource PersonalEducation record.
            
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.ScoreNo.Text, PersonalEducationTable.ScoreNo)			

                      
        End Sub
                
        Public Overridable Sub GetStartDate()
            
            ' Retrieve the value entered by the user on the StartDate ASP:TextBox, and
            ' save it into the StartDate field in DataSource PersonalEducation record.
            ' Parse will also validate the date to ensure it is of the proper format
            ' and a valid date.  The format is verified based on the current culture 
            ' settings including the order of month, day and year and the separator character.
            ' Parse throws an exception if the date is invalid.
            ' Custom validation should be performed in Validate, not here.
            
            'Save the value to data source
            Me.DataSource.Parse(Me.StartDate.Text, PersonalEducationTable.StartDate)			

                      
        End Sub
                
      
        ' To customize, override this method in PersonalEducationRecordControl.
        
        Public Overridable Function CreateWhereClause() As WhereClause
        
            Dim wc As WhereClause
            PersonalEducationTable.Instance.InnerFilter = Nothing
            wc = New WhereClause()
            
            ' Compose the WHERE clause consiting of:
            ' 1. Static clause defined at design time.
            ' 2. User selected filter criteria.
            ' 3. User selected search criteria.
            
            ' Retrieve the record id from the URL parameter.
            Dim recId As String = Me.Page.Request.QueryString.Item("PersonalEducation")
            If recId Is Nothing OrElse recId.Trim = "" Then
                
                Return Nothing
                
            End If
              
            HttpContext.Current.Session("QueryString in AddPersonalEducation") = recId
                
            If KeyValue.IsXmlKey(recId) Then
                ' Keys are typically passed as XML structures to handle composite keys.
                ' If XML, then add a Where clause based on the Primary Key in the XML.
                Dim pkValue As KeyValue = KeyValue.XmlToKey(recId)
                 
                wc.iAND(PersonalEducationTable.EducationId, BaseFilter.ComparisonOperator.EqualsTo, pkValue.GetColumnValueString(PersonalEducationTable.EducationId))
        
                    Else
                    ' The URL parameter contains the actual value, not an XML structure.
                    
                wc.iAND(PersonalEducationTable.EducationId, BaseFilter.ComparisonOperator.EqualsTo, recId)
        
            End If
                
            Return wc
            
        End Function
        
        ' This CreateWhereClause is used for loading list of suggestions for Auto Type-Ahead feature.
        
        Public Overridable Function CreateWhereClause(ByVal searchText As String, ByVal fromSearchControl As String, ByVal AutoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String) As WhereClause
            PersonalEducationTable.Instance.InnerFilter = Nothing
            Dim wc As WhereClause = New WhereClause()
        
            ' Compose the WHERE clause consiting of:
            ' 1. Static clause defined at design time.
            ' 2. User selected filter criteria.
            ' 3. User selected search criteria.
            Dim appRelativeVirtualPath As String = CType(HttpContext.Current.Session("AppRelativeVirtualPath"), String)

            
            ' Adds clauses if values are selected in Filter controls which are configured in the page.
          
       
          
            Return wc
        End Function
          
          
        'Formats the resultItem and adds it to the list of suggestions.
        Public Overridable Function FormatSuggestions(ByVal prefixText As String, ByVal resultItem As String, _
                                                 ByVal columnLength As Integer, ByVal AutoTypeAheadDisplayFoundText As String, _
                                                 ByVal autoTypeAheadSearch As String, ByVal AutoTypeAheadWordSeparators As String, _
                                                 ByVal resultList As ArrayList) As Boolean
            Dim index As Integer = resultItem.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture).IndexOf(prefixText.ToUpper(System.Threading.Thread.CurrentThread.CurrentCulture))
            Dim itemToAdd As String = ""
            Dim isFound As Boolean = False
            Dim isAdded As Boolean = False
            ' Get the index where prfixt is at the beginning of resultItem. If not found then, index of word which begins with prefixText.
            If InvariantLCase(autoTypeAheadSearch).equals("wordsstartingwithsearchstring") and not index = 0 Then
                ' Expression to find word which contains AutoTypeAheadWordSeparators followed by prefixText
                Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex( AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase)
                If regex1.IsMatch(resultItem) Then
                    index = regex1.Match(resultItem).Index
                    isFound = True
                End If
                ' If the prefixText is found immediatly after white space then starting of the word is found so don not search any further
                If not resultItem(index).ToString() = " " Then
                    ' Expression to find beginning of the word which contains AutoTypeAheadWordSeparators followed by prefixText
                    Dim regex As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + AutoTypeAheadWordSeparators + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase)
                    If regex.IsMatch(resultItem) Then
                        index = regex.Match(resultItem).Index
                        isFound = True
                    End If
                 End If
            End If
            ' If autoTypeAheadSearch value is wordsstartingwithsearchstring then, extract the substring only if the prefixText is found at the 
            ' beginning of the resultItem (index = 0) or a word in resultItem is found starts with prefixText. 
            If index = 0 Or isFound Or InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") then
                If InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atbeginningofmatchedstring") Then
                    ' Expression to find beginning of the word which contains prefixText
                    Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\\S*" + prefixText, System.Text.RegularExpressions.RegexOptions.IgnoreCase)
                    '  Find the beginning of the word which contains prefexText
                    If (StringUtils.InvariantLCase(autoTypeAheadSearch).Equals("anywhereinstring") AndAlso regex1.IsMatch(resultItem)) Then
                        index = regex1.Match(resultItem).Index
                        isFound = True
                    End If
                    ' Display string from the index till end of the string if sub string from index till end is less than columnLength value.
                    If Len(resultItem) - index <= columnLength Then
                        If index = 0 Then 
                            itemToAdd = resultItem 
                        Else
                            itemToAdd = "..." & resultItem.Substring(index, Len(resultItem) - index) 
                        End If
                    Else
                        If index = 0 Then
                            itemToAdd = resultItem.Substring(index, (columnLength - 3)) & "..."
                        Else
                            'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended.
                            itemToAdd = "..." & resultItem.Substring(index , columnLength - 6) & "..." 
                        End If
                    End If
                ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("inmiddleofmatchedstring") Then
                    Dim subStringBeginIndex As Integer = CType(columnLength/2, Integer)
                    If Len(resultItem) <= columnLength Then
                        itemToAdd = resultItem
                    Else
                        ' Sanity check at end of the string
                        If index + Len(prefixText) = columnLength Then
                            itemToAdd =  "..." & resultItem.Substring(index-columnLength,index)
                        ElseIf Len(resultItem) - index < subStringBeginIndex Then 
                            ' Display string from the end till columnLength value if, index is closer to the end of the string.
                            itemToAdd =  "..." & resultItem.Substring(Len(resultItem)-columnLength,Len(resultItem))
                        ElseIf index <= subStringBeginIndex Then 
                            ' Sanity chet at beginning of the string
                            itemToAdd =  resultItem.Substring(0, columnLength) & "..."
                        Else
                            ' Display string containing text before the prefixText occures and text after the prefixText
                            itemToAdd =  "..." & resultItem.Substring(index - subStringBeginIndex, columnLength) & "..." 
                        End If
                    End If
                ElseIf InvariantLCase(AutoTypeAheadDisplayFoundText).equals("atendofmatchedstring") Then
                     ' Expression to find ending of the word which contains prefexText
                    Dim regex1 As System.Text.RegularExpressions.Regex = new System.Text.RegularExpressions.Regex("\s", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
                    ' Find the ending of the word which contains prefexText
                    If regex1.IsMatch(resultItem, index + 1) Then
                        index = regex1.Match(resultItem, index + 1).Index
                    Else
                        ' If the word which contains prefexText is the last word in string, regex1.IsMatch returns false.
                        index = resultItem.Length
                    End If
                    If index > Len(resultItem) Then
                        index = Len(resultItem)
                    End If
                    ' If text from beginning of the string till index is less than columnLength value then, display string from the beginning till index.
                    If  index <= columnLength Then
                        if index = Len(resultItem) then   'Make decision to append "..."
                            itemToAdd = resultItem.Substring(0,index)
                        Else
                            itemToAdd = resultItem.Substring(0,index) & "..."
                        End If
                    Else
                        If index = Len(resultItem) Then
                            itemToAdd = "..." & resultItem.Substring(index - (columnLength - 3), (columnLength - 3))
                        Else
                            'Truncate the string to show only columnLength - 6 characters as begining and trailing "..." has to be appended.
                            itemToAdd = "..." & resultItem.Substring(index - (columnLength - 6), columnLength - 6) & "..." 
                        End If
                    End If
                End If
                
                ' Remove newline character from itemToAdd
                Dim prefixTextIndex As Integer = itemToAdd.IndexOf(prefixText, StringComparison.CurrentCultureIgnoreCase)
                ' If itemToAdd contains any newline after the search text then show text only till newline
                Dim regex2 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", System.Text.RegularExpressions.RegexOptions.IgnoreCase)
                Dim newLineIndexAfterPrefix As Integer = -1
                If regex2.IsMatch(itemToAdd, prefixTextIndex) Then
                    newLineIndexAfterPrefix = regex2.Match(itemToAdd, prefixTextIndex).Index
                End If
                If (newLineIndexAfterPrefix > -1) Then
                    If itemToAdd.EndsWith("...") Then
                        itemToAdd = (itemToAdd.Substring(0, newLineIndexAfterPrefix) + "...")
                    Else
                        itemToAdd = itemToAdd.Substring(0, newLineIndexAfterPrefix)
                    End If
                End If
                ' If itemToAdd contains any newline before search text then show text which comes after newline
                Dim regex3 As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex("(" & vbCrLf & "|" & vbLf & ")", (System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.RightToLeft))
                Dim newLineIndexBeforePrefix As Integer = -1
                If regex3.IsMatch(itemToAdd, prefixTextIndex) Then
                    newLineIndexBeforePrefix = regex3.Match(itemToAdd, prefixTextIndex).Index
                End If
                If (newLineIndexBeforePrefix > -1) Then
                    If itemToAdd.StartsWith("...") Then
                        itemToAdd = ("..." + itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length)))
                    Else
                        itemToAdd = itemToAdd.Substring((newLineIndexBeforePrefix + regex3.Match(itemToAdd, prefixTextIndex).Length))
                    End If
                End If

                If Not itemToAdd is nothing AndAlso Not resultList.Contains(itemToAdd) Then
                    resultList.Add(itemToAdd)
                    isAdded = true
                End If
            End If
            Return isAdded
        End Function
        
    

        ' To customize, override this method in PersonalEducationRecordControl.
        Public Overridable Sub Validate() 
            ' Add custom validation for any control within this panel.
            ' Example.  If you have a State ASP:Textbox control
            ' If Me.State.Text <> "CA" Then
            '    Throw New Exception("State must be CA (California).")
            ' End If

            ' The Validate method is common across all controls within
            ' this panel so you can validate multiple fields, but report
            ' one error message.
            
                
        End Sub

        Public Overridable Sub Delete()
        
            If Me.IsNewRecord() Then
                Return
            End If

            Dim pkValue As KeyValue = KeyValue.XmlToKey(Me.RecordUniqueId)
          PersonalEducationTable.DeleteRecord(pkValue)
          
        End Sub

        Protected Overridable Sub Control_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
            ' PreRender event is raised just before page is being displayed.
            Try
                DbUtils.StartTransaction()
                Me.RegisterPostback()

                If Not Me.Page.ErrorOnPage AndAlso (Me.Page.IsPageRefresh OrElse Me.DataChanged OrElse Me.ResetData) Then
                  
                
                    ' Re-load the data and update the web page if necessary.
                    ' This is typically done during a postback (filter, search button, sort, pagination button).
                    ' In each of the other click handlers, simply set DataChanged to True to reload the data.
                    Me.LoadData()
                    Me.DataBind()			
                End If
                                
                						
            Catch ex As Exception
                Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message)
            Finally
                DbUtils.EndTransaction()
            End Try
        End Sub
        
            
        Protected Overrides Sub SaveControlsToSession()
            MyBase.SaveControlsToSession()
        
    
            'Save pagination state to session.
          
        End Sub
        
        
    
        Protected Overrides Sub ClearControlsFromSession()
            MyBase.ClearControlsFromSession()

        

            ' Clear pagination state from session.
        
        End Sub

        Protected Overrides Sub LoadViewState(ByVal savedState As Object)
            MyBase.LoadViewState(savedState)
            Dim isNewRecord As String = CType(ViewState("IsNewRecord"), String)
            If Not isNewRecord Is Nothing AndAlso isNewRecord.Trim <> "" Then
                Me.IsNewRecord = Boolean.Parse(isNewRecord)
            End If
            
            Dim myCheckSum As String = CType(ViewState("CheckSum"), String)
            If Not myCheckSum Is Nothing AndAlso myCheckSum.Trim <> "" Then
                Me.CheckSum = myCheckSum
            End If
            
    
            ' Load view state for pagination control.
                 
        End Sub

        Protected Overrides Function SaveViewState() As Object
            ViewState("IsNewRecord") = Me.IsNewRecord.ToString()
            ViewState("CheckSum") = Me.CheckSum
            
    
            ' Load view state for pagination control.
                  
            Return MyBase.SaveViewState()
        End Function
        
        
        ' Generate the event handling functions for pagination events.
            
      
        ' Generate the event handling functions for filter and search events.
            

        Public Overridable Function CreateWhereClause_COUNTRYDropDownList() As WhereClause
            ' By default, we simply return a new WhereClause.
            ' Add additional where clauses to restrict the items shown in the dropdown list.
            						
            ' This WhereClause is for the Country table.
            ' Examples:
            ' wc.iAND(CountryTable.Country, BaseFilter.ComparisonOperator.EqualsTo, "XYZ")
            ' wc.iAND(CountryTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1")
            
            Dim wc As WhereClause = New WhereClause()
            Return wc
            				
        End Function
        
                

        Public Overridable Function CreateWhereClause_LevelIdDropDownList() As WhereClause
            ' By default, we simply return a new WhereClause.
            ' Add additional where clauses to restrict the items shown in the dropdown list.
            						
            ' This WhereClause is for the Education table.
            ' Examples:
            ' wc.iAND(EducationTable.Level, BaseFilter.ComparisonOperator.EqualsTo, "XYZ")
            ' wc.iAND(EducationTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1")
            
            Dim wc As WhereClause = New WhereClause()
            Return wc
            				
        End Function
        
                

        Public Overridable Function CreateWhereClause_PersonalIdDropDownList() As WhereClause
            ' By default, we simply return a new WhereClause.
            ' Add additional where clauses to restrict the items shown in the dropdown list.
            						
            ' This WhereClause is for the PersonalId table.
            ' Examples:
            ' wc.iAND(PersonalIdTable.PersonalName, BaseFilter.ComparisonOperator.EqualsTo, "XYZ")
            ' wc.iAND(PersonalIdTable.Active, BaseFilter.ComparisonOperator.EqualsTo, "1")
            
            Dim wc As WhereClause = New WhereClause()
            Return wc
            				
        End Function
        
                
        ' Fill the COUNTRY list.
        Protected Overridable Sub PopulateCOUNTRYDropDownList( _
                ByVal selectedValue As String, _
                ByVal maxItems As Integer)
            		  					                
            Me.COUNTRY.Items.Clear()
            
                    
            ' 1. Setup the static list items        
            
            ' Add the Please Select item.
            Me.COUNTRY.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--"))
                            		  			
            ' 2. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_COUNTRYDropDownList function.
            ' It is better to customize the where clause there.
            
            Dim wc As WhereClause = CreateWhereClause_COUNTRYDropDownList()
            ' Create the ORDER BY clause to sort based on the displayed value.			
                

            Dim orderBy As OrderBy = New OrderBy(false, false)			
                          orderBy.Add(CountryTable.Country, OrderByItem.OrderDir.Asc)

                      Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
                      
            ' 3. Read a total of maxItems from the database and insert them		
            Dim itemValues() As CountryRecord = Nothing
            Dim evaluator As New FormulaEvaluator                
            If wc.RunQuery
                Dim counter As Integer = 0
                Dim pageNum As Integer = 0
                Dim listDuplicates As New ArrayList()

                Do
                    itemValues = CountryTable.GetRecords(wc, orderBy, pageNum, maxItems)
                    For each itemValue As CountryRecord In itemValues
                        ' Create the item and add to the list.
                        Dim cvalue As String = Nothing
                        Dim fvalue As String = Nothing
                        If itemValue.CountryIdSpecified Then
                            cvalue = itemValue.CountryId.ToString() 
                            
                        If counter < maxItems AndAlso Me.COUNTRY.Items.FindByValue(cvalue) Is Nothing Then
                      
                          Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY)
                          If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then
                          fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY)
                          End If
                          If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
                          fvalue = itemValue.Format(CountryTable.Country)
                          End If
                        
                      If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue

                      If (IsNothing(fvalue)) Then
                         fvalue = ""
                      End If

                      fvalue = fvalue.Trim()

                      If ( fvalue.Length > 50 ) Then
                          fvalue = fvalue.Substring(0, 50) & "..."
                      End If

                      Dim dupItem As ListItem = Me.COUNTRY.Items.FindByText(fvalue)
								
                      If Not IsNothing(dupItem) Then
                          listDuplicates.Add(fvalue)
                          dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")"
                      End If

                      Dim newItem As ListItem = New ListItem(fvalue, cvalue)
                      Me.COUNTRY.Items.Add(newItem)

                      If listDuplicates.Contains(fvalue) Then
                          newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")"
                      End If

                                counter += 1			  
                            End If
                        End If
                    Next
                    pageNum += 1
                Loop While (itemValues.Length = maxItems AndAlso counter < maxItems)
            End If
                            
                    
            ' 4. Set the selected value (insert if not already present).
              
            If Not selectedValue Is Nothing AndAlso _
                selectedValue.Trim <> "" AndAlso _
                Not SetSelectedValue(Me.COUNTRY, selectedValue) AndAlso _
                Not SetSelectedDisplayText(Me.COUNTRY, selectedValue)Then

                ' construct a whereclause to query a record with Country.CountryId = selectedValue
                Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing)
                Dim whereClause2 As WhereClause = New WhereClause()
                filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(CountryTable.CountryId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False))
                whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator)

                Try
                    ' Execute the query
                    Dim rc() As CountryRecord = CountryTable.GetRecords(whereClause2, New OrderBy(False, False), 0, 1)
                      Dim vars As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
                      ' if find a record, add it to the dropdown and set it as selected item
                      If rc IsNot Nothing AndAlso rc.Length = 1 Then
                      Dim itemValue As CountryRecord = DirectCast(rc(0), CountryRecord)
                        ' Create the item and add to the list.
                        Dim cvalue As String = Nothing
                        Dim fvalue As String = Nothing
                        If itemValue.CountryIdSpecified Then
                            cvalue = itemValue.CountryId.ToString() 
                          Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.COUNTRY)
                          If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.COUNTRY.IsApplyDisplayAs Then
                          fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.COUNTRY)
                          End If
                          If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
                          fvalue = itemValue.Format(CountryTable.Country)
                          End If
                        
                      If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue
                      Dim newItem As New ListItem(fvalue, cvalue)
                      Me.COUNTRY.Items.Add(newItem)
                      SetSelectedValue(Me.COUNTRY, selectedValue)
                            End If
                        End If
                Catch
                End Try

            End If					
                        
                
        End Sub
                
        ' Fill the LevelId list.
        Protected Overridable Sub PopulateLevelIdDropDownList( _
                ByVal selectedValue As String, _
                ByVal maxItems As Integer)
            		  					                
            Me.LevelId.Items.Clear()
            
                    
            ' 1. Setup the static list items        
            
            ' Add the Please Select item.
            Me.LevelId.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--"))
                            		  			
            ' 2. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_LevelIdDropDownList function.
            ' It is better to customize the where clause there.
            
            Dim wc As WhereClause = CreateWhereClause_LevelIdDropDownList()
            ' Create the ORDER BY clause to sort based on the displayed value.			
                

            Dim orderBy As OrderBy = New OrderBy(false, false)			
                          orderBy.Add(EducationTable.Level, OrderByItem.OrderDir.Asc)

                      Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
                      
            ' 3. Read a total of maxItems from the database and insert them		
            Dim itemValues() As EducationRecord = Nothing
            Dim evaluator As New FormulaEvaluator                
            If wc.RunQuery
                Dim counter As Integer = 0
                Dim pageNum As Integer = 0
                Dim listDuplicates As New ArrayList()

                Do
                    itemValues = EducationTable.GetRecords(wc, orderBy, pageNum, maxItems)
                    For each itemValue As EducationRecord In itemValues
                        ' Create the item and add to the list.
                        Dim cvalue As String = Nothing
                        Dim fvalue As String = Nothing
                        If itemValue.EducationIdSpecified Then
                            cvalue = itemValue.EducationId.ToString() 
                            
                        If counter < maxItems AndAlso Me.LevelId.Items.FindByValue(cvalue) Is Nothing Then
                      
                          Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId)
                          If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then
                          fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId)
                          End If
                          If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
                          fvalue = itemValue.Format(EducationTable.Level)
                          End If
                        
                      If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue

                      If (IsNothing(fvalue)) Then
                         fvalue = ""
                      End If

                      fvalue = fvalue.Trim()

                      If ( fvalue.Length > 50 ) Then
                          fvalue = fvalue.Substring(0, 50) & "..."
                      End If

                      Dim dupItem As ListItem = Me.LevelId.Items.FindByText(fvalue)
								
                      If Not IsNothing(dupItem) Then
                          listDuplicates.Add(fvalue)
                          dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")"
                      End If

                      Dim newItem As ListItem = New ListItem(fvalue, cvalue)
                      Me.LevelId.Items.Add(newItem)

                      If listDuplicates.Contains(fvalue) Then
                          newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")"
                      End If

                                counter += 1			  
                            End If
                        End If
                    Next
                    pageNum += 1
                Loop While (itemValues.Length = maxItems AndAlso counter < maxItems)
            End If
                            
                    
            ' 4. Set the selected value (insert if not already present).
              
            If Not selectedValue Is Nothing AndAlso _
                selectedValue.Trim <> "" AndAlso _
                Not SetSelectedValue(Me.LevelId, selectedValue) AndAlso _
                Not SetSelectedDisplayText(Me.LevelId, selectedValue)Then

                ' construct a whereclause to query a record with Education.EducationId = selectedValue
                Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing)
                Dim whereClause2 As WhereClause = New WhereClause()
                filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(EducationTable.EducationId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False))
                whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator)

                Try
                    ' Execute the query
                    Dim rc() As EducationRecord = EducationTable.GetRecords(whereClause2, New OrderBy(False, False), 0, 1)
                      Dim vars As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
                      ' if find a record, add it to the dropdown and set it as selected item
                      If rc IsNot Nothing AndAlso rc.Length = 1 Then
                      Dim itemValue As EducationRecord = DirectCast(rc(0), EducationRecord)
                        ' Create the item and add to the list.
                        Dim cvalue As String = Nothing
                        Dim fvalue As String = Nothing
                        If itemValue.EducationIdSpecified Then
                            cvalue = itemValue.EducationId.ToString() 
                          Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.LevelId)
                          If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.LevelId.IsApplyDisplayAs Then
                          fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.LevelId)
                          End If
                          If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
                          fvalue = itemValue.Format(EducationTable.Level)
                          End If
                        
                      If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue
                      Dim newItem As New ListItem(fvalue, cvalue)
                      Me.LevelId.Items.Add(newItem)
                      SetSelectedValue(Me.LevelId, selectedValue)
                            End If
                        End If
                Catch
                End Try

            End If					
                        
                
        End Sub
                
        ' Fill the PersonalId list.
        Protected Overridable Sub PopulatePersonalIdDropDownList( _
                ByVal selectedValue As String, _
                ByVal maxItems As Integer)
            		  					                
            Me.PersonalId.Items.Clear()
            
                    
            ' 1. Setup the static list items        
            
            ' Add the Please Select item.
            Me.PersonalId.Items.Insert(0, new ListItem(Me.Page.GetResourceValue("Txt:PleaseSelect", "Persons"), "--PLEASE_SELECT--"))
                            		  			
            ' 2. Set up the WHERE and the ORDER BY clause by calling the CreateWhereClause_PersonalIdDropDownList function.
            ' It is better to customize the where clause there.
            
            Dim wc As WhereClause = CreateWhereClause_PersonalIdDropDownList()
            ' Create the ORDER BY clause to sort based on the displayed value.			
                

            Dim orderBy As OrderBy = New OrderBy(false, false)			
                          orderBy.Add(PersonalIdTable.PersonalName, OrderByItem.OrderDir.Asc)

                      Dim variables As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
                      
            ' 3. Read a total of maxItems from the database and insert them		
            Dim itemValues() As PersonalIdRecord = Nothing
            Dim evaluator As New FormulaEvaluator                
            If wc.RunQuery
                Dim counter As Integer = 0
                Dim pageNum As Integer = 0
                Dim listDuplicates As New ArrayList()

                Do
                    itemValues = PersonalIdTable.GetRecords(wc, orderBy, pageNum, maxItems)
                    For each itemValue As PersonalIdRecord In itemValues
                        ' Create the item and add to the list.
                        Dim cvalue As String = Nothing
                        Dim fvalue As String = Nothing
                        If itemValue.PersonalIdSpecified Then
                            cvalue = itemValue.PersonalId.ToString() 
                            
                        If counter < maxItems AndAlso Me.PersonalId.Items.FindByValue(cvalue) Is Nothing Then
                      
                          Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId)
                          If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then
                          fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId)
                          End If
                          If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
                          fvalue = itemValue.Format(PersonalIdTable.PersonalName)
                          End If
                        
                      If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue

                      If (IsNothing(fvalue)) Then
                         fvalue = ""
                      End If

                      fvalue = fvalue.Trim()

                      If ( fvalue.Length > 50 ) Then
                          fvalue = fvalue.Substring(0, 50) & "..."
                      End If

                      Dim dupItem As ListItem = Me.PersonalId.Items.FindByText(fvalue)
								
                      If Not IsNothing(dupItem) Then
                          listDuplicates.Add(fvalue)
                          dupItem.Text = fvalue & " (ID " & dupItem.Value.Substring(0, Math.Min(dupItem.Value.Length,38)) & ")"
                      End If

                      Dim newItem As ListItem = New ListItem(fvalue, cvalue)
                      Me.PersonalId.Items.Add(newItem)

                      If listDuplicates.Contains(fvalue) Then
                          newItem.Text = fvalue & " (ID " & cvalue.Substring(0, Math.Min(cvalue.Length,38)) & ")"
                      End If

                                counter += 1			  
                            End If
                        End If
                    Next
                    pageNum += 1
                Loop While (itemValues.Length = maxItems AndAlso counter < maxItems)
            End If
                            
                    
            ' 4. Set the selected value (insert if not already present).
              
            If Not selectedValue Is Nothing AndAlso _
                selectedValue.Trim <> "" AndAlso _
                Not SetSelectedValue(Me.PersonalId, selectedValue) AndAlso _
                Not SetSelectedDisplayText(Me.PersonalId, selectedValue)Then

                ' construct a whereclause to query a record with PersonalId.PersonalId = selectedValue
                Dim filter2 As CompoundFilter = New CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, Nothing)
                Dim whereClause2 As WhereClause = New WhereClause()
                filter2.AddFilter(New BaseClasses.Data.ColumnValueFilter(PersonalIdTable.PersonalId, selectedValue, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, False))
                whereClause2.AddFilter(filter2, CompoundFilter.CompoundingOperators.And_Operator)

                Try
                    ' Execute the query
                    Dim rc() As PersonalIdRecord = PersonalIdTable.GetRecords(whereClause2, New OrderBy(False, False), 0, 1)
                      Dim vars As System.Collections.Generic.IDictionary(Of String, Object) = New System.Collections.Generic.Dictionary(Of String, Object)
                      ' if find a record, add it to the dropdown and set it as selected item
                      If rc IsNot Nothing AndAlso rc.Length = 1 Then
                      Dim itemValue As PersonalIdRecord = DirectCast(rc(0), PersonalIdRecord)
                        ' Create the item and add to the list.
                        Dim cvalue As String = Nothing
                        Dim fvalue As String = Nothing
                        If itemValue.PersonalIdSpecified Then
                            cvalue = itemValue.PersonalId.ToString() 
                          Dim _isExpandableNonCompositeForeignKey As Boolean = PersonalEducationTable.Instance.TableDefinition.IsExpandableNonCompositeForeignKey(PersonalEducationTable.PersonalId)
                          If _isExpandableNonCompositeForeignKey AndAlso PersonalEducationTable.PersonalId.IsApplyDisplayAs Then
                          fvalue = PersonalEducationTable.GetDFKA(itemValue, PersonalEducationTable.PersonalId)
                          End If
                          If (Not _isExpandableNonCompositeForeignKey) Or (String.IsNullOrEmpty(fvalue)) Then
                          fvalue = itemValue.Format(PersonalIdTable.PersonalName)
                          End If
                        
                      If fvalue Is Nothing OrElse fvalue.Trim() = "" Then fvalue = cvalue
                      Dim newItem As New ListItem(fvalue, cvalue)
                      Me.PersonalId.Items.Add(newItem)
                      SetSelectedValue(Me.PersonalId, selectedValue)
                            End If
                        End If
                Catch
                End Try

            End If					
                        
                
        End Sub
                
        Protected Overridable Sub COUNTRY_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs)

            ' for the value inserted by quick add button or large list selector, 
            ' the value is necessary to be inserted by this event during postback 
            Dim val As String = CType(Me.Page.Session()(COUNTRY.ClientID & "_SelectedValue"), String)
            Dim displayText As String = CType(Me.Page.Session()(COUNTRY.ClientID & "_SelectedDisplayText"), String)
            If displayText <> "" AndAlso val <> "" Then
                Me.COUNTRY.Items.Add(New ListItem(displayText, val))
                Me.COUNTRY.SelectedIndex = Me.COUNTRY.Items.Count - 1
                Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedValue")
                Me.Page.Session.Remove(COUNTRY.ClientID & "_SelectedDisplayText")
            End If

          									
                
                
        End Sub
            
        Protected Overridable Sub LevelId_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs)

            ' for the value inserted by quick add button or large list selector, 
            ' the value is necessary to be inserted by this event during postback 
            Dim val As String = CType(Me.Page.Session()(LevelId.ClientID & "_SelectedValue"), String)
            Dim displayText As String = CType(Me.Page.Session()(LevelId.ClientID & "_SelectedDisplayText"), String)
            If displayText <> "" AndAlso val <> "" Then
                Me.LevelId.Items.Add(New ListItem(displayText, val))
                Me.LevelId.SelectedIndex = Me.LevelId.Items.Count - 1
                Me.Page.Session.Remove(LevelId.ClientID & "_SelectedValue")
                Me.Page.Session.Remove(LevelId.ClientID & "_SelectedDisplayText")
            End If

          									
                
                
        End Sub
            
        Protected Overridable Sub PersonalId_SelectedIndexChanged(ByVal sender As Object, ByVal args As EventArgs)

            ' for the value inserted by quick add button or large list selector, 
            ' the value is necessary to be inserted by this event during postback 
            Dim val As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedValue"), String)
            Dim displayText As String = CType(Me.Page.Session()(PersonalId.ClientID & "_SelectedDisplayText"), String)
            If displayText <> "" AndAlso val <> "" Then
                Me.PersonalId.Items.Add(New ListItem(displayText, val))
                Me.PersonalId.SelectedIndex = Me.PersonalId.Items.Count - 1
                Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedValue")
                Me.Page.Session.Remove(PersonalId.ClientID & "_SelectedDisplayText")
            End If

          									
                
                
        End Sub
            
        Protected Overridable Sub Command_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub CommandDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub Course_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub CourseAbbr_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub CourseNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub EducationPeriod_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub EducationType_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub EdYear_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub EndDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub Facultry_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub Institue_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub NoAll_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub Score_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub ScoreNo_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
        Protected Overridable Sub StartDate_TextChanged(ByVal sender As Object, ByVal args As EventArgs)                
                    
              End Sub
            
   
        Private _PreviousUIData As New Hashtable
        Public Overridable Property PreviousUIData() As Hashtable
            Get
                Return _PreviousUIData
            End Get
            Set(ByVal value As Hashtable)
                _PreviousUIData = value
            End Set
        End Property   
   
        Private _IsNewRecord As Boolean = True
        Public Overridable Property IsNewRecord() As Boolean
            Get
                Return Me._IsNewRecord
            End Get
            Set(ByVal value As Boolean)
                Me._IsNewRecord = value
            End Set
        End Property

        Private _DataChanged As Boolean = False
        Public Overridable Property DataChanged() As Boolean
            Get
                Return Me._DataChanged
            End Get
            Set(ByVal Value As Boolean)
                Me._DataChanged = Value
            End Set
        End Property

        Private _ResetData As Boolean = False
        Public Overridable Property ResetData() As Boolean
            Get
                Return Me._ResetData
            End Get
            Set(ByVal Value As Boolean)
                Me._ResetData = Value
            End Set
        End Property
        
        Public Property RecordUniqueId() As String
            Get
                Return CType(Me.ViewState("BasePersonalEducationRecordControl_Rec"), String)
            End Get
            Set(ByVal value As String)
                Me.ViewState("BasePersonalEducationRecordControl_Rec") = value
            End Set
        End Property
        
        Private _DataSource As PersonalEducationRecord
        Public Property DataSource() As PersonalEducationRecord     
            Get
                Return Me._DataSource
            End Get
            
            Set(ByVal value As PersonalEducationRecord)
            
                Me._DataSource = value
            End Set
        End Property

        

        Private _checkSum As String
        Public Overridable Property CheckSum() As String
            Get
                Return Me._checkSum
            End Get
            Set(ByVal value As String)
                Me._checkSum = value
            End Set
        End Property
        
        Private _TotalPages As Integer
        Public Property TotalPages() As Integer
            Get
                Return Me._TotalPages
            End Get
            Set(ByVal value As Integer)
                Me._TotalPages = value
            End Set
        End Property
        
        Private _PageIndex As Integer
        Public Property PageIndex() As Integer
            Get
                ' Return the PageIndex
                Return Me._PageIndex
            End Get
            Set(ByVal value As Integer)
                Me._PageIndex = value
            End Set
        End Property
    
        Private _PageSize As Integer
        Public Property PageSize() As Integer
            Get
                Return Me._PageSize
            End Get
            Set(ByVal value As Integer)
                Me._PageSize = value
            End Set
        End Property
    
        Private _TotalRecords As Integer
        Public Property TotalRecords() As Integer
            Get
                Return Me._TotalRecords
            End Get
            Set(ByVal value As Integer)
                If Me.PageSize > 0 Then
                    Me.TotalPages = CInt(Math.Ceiling(value / Me.PageSize))
                End If

                Me._TotalRecords = value
            End Set
        End Property
        
        Private _DisplayLastPage As Boolean
        Public Property DisplayLastPage() As Boolean
            Get
                Return Me._DisplayLastPage
            End Get
            Set(ByVal value As Boolean)
                Me._DisplayLastPage = value
            End Set
        End Property
        
        

#Region "Helper Properties"
        
        Public ReadOnly Property Command() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Command"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property CommandDate() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDate"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property CommandDateLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandDateLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property CommandLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CommandLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property COUNTRY() As System.Web.UI.WebControls.DropDownList
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRY"), System.Web.UI.WebControls.DropDownList)
            End Get
        End Property
            
        Public ReadOnly Property COUNTRYLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "COUNTRYLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property Course() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Course"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property CourseAbbr() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbr"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property CourseAbbrLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseAbbrLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property CourseLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property CourseNo() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNo"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property CourseNoLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "CourseNoLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property EducationPeriod() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriod"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property EducationPeriodLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationPeriodLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property EducationType() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationType"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property EducationTypeLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EducationTypeLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property EdYear() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYear"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property EdYearLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EdYearLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property EndDate() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDate"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property EndDateLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "EndDateLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property Facultry() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Facultry"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property FacultryLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "FacultryLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property Institue() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Institue"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property InstitueLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "InstitueLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property LevelId() As System.Web.UI.WebControls.DropDownList
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelId"), System.Web.UI.WebControls.DropDownList)
            End Get
        End Property
            
        Public ReadOnly Property LevelIdLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "LevelIdLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property NoAll() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAll"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property NoAllLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "NoAllLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property PersonalEducationRecordControlCollapsibleRegion() As System.Web.UI.WebControls.Panel
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlCollapsibleRegion"), System.Web.UI.WebControls.Panel)
            End Get
        End Property
        
        Public ReadOnly Property PersonalEducationRecordControlIcon() As System.Web.UI.WebControls.ImageButton
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlIcon"), System.Web.UI.WebControls.ImageButton)
            End Get
        End Property
        
        Public ReadOnly Property PersonalEducationRecordControlPanelExtender() As AjaxControlToolkit.CollapsiblePanelExtender
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationRecordControlPanelExtender"), AjaxControlToolkit.CollapsiblePanelExtender)
            End Get
        End Property
        
        Public ReadOnly Property PersonalEducationTitle() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalEducationTitle"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property PersonalId() As System.Web.UI.WebControls.DropDownList
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalId"), System.Web.UI.WebControls.DropDownList)
            End Get
        End Property
            
        Public ReadOnly Property PersonalIdAddRecordLink() As System.Web.UI.WebControls.ImageButton
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdAddRecordLink"), System.Web.UI.WebControls.ImageButton)
            End Get
        End Property
        
        Public ReadOnly Property PersonalIdLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "PersonalIdLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property Score() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "Score"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property ScoreLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property ScoreNo() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNo"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property ScoreNoLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "ScoreNoLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
        Public ReadOnly Property StartDate() As System.Web.UI.WebControls.TextBox
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDate"), System.Web.UI.WebControls.TextBox)
            End Get
        End Property
            
        Public ReadOnly Property StartDateLabel() As System.Web.UI.WebControls.Literal
            Get
                Return CType(BaseClasses.Utils.MiscUtils.FindControlRecursively(Me, "StartDateLabel"), System.Web.UI.WebControls.Literal)
            End Get
        End Property
        
#End Region

#Region "Helper Functions"

        Public Overrides Overloads Function ModifyRedirectUrl(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String
            Return Me.Page.EvaluateExpressions(url, arg, bEncrypt, Me)
        End Function

        Public Overrides Overloads Function EvaluateExpressions(ByVal url As String, ByVal arg As String, ByVal bEncrypt As Boolean) As String
            
            Dim rec As PersonalEducationRecord = Nothing
             
        
            Try
                rec = Me.GetRecord()
            Catch ex As Exception
                ' Do nothing
            End Try

            If rec Is Nothing AndAlso url.IndexOf("{") >= 0 Then
                ' Localization.
                
            Throw New Exception(Page.GetResourceValue("Err:RecDataSrcNotInitialized", "Persons"))
                    
            End If
            Return EvaluateExpressions(url, arg, rec, bEncrypt)
        End Function

         
        Public Overridable Function GetRecord() As PersonalEducationRecord
            If Not Me.DataSource Is Nothing Then
              Return Me.DataSource
            End If
            
            
            Return New PersonalEducationRecord()
            
        End Function

        Public Shadows ReadOnly Property Page() As BaseApplicationPage
            Get
                Return DirectCast(MyBase.Page, BaseApplicationPage)
            End Get
        End Property

#End Region

End Class

  

#End Region
    
  
End Namespace

  