Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
UltraganttView printpreview problem
posted

foreach (DataRelation rs in dbComm.ds.Relations)
{
    Debug.WriteLine(rs.RelationName);
    Debug.WriteLine(rs.ParentKeyConstraint.ConstraintName);
    Debug.WriteLine(rs.ChildKeyConstraint.ConstraintName);
    foreach (DataColumn col in rs.ChildColumns)
    {
        Debug.WriteLine(col.ColumnName);
    }
    foreach (DataColumn col in rs.ParentColumns)
    {
        Debug.WriteLine(col.ColumnName);
    }
}

for (int i = 0; i < this.ultraGanttView1.Project.Tasks.Count; i++)
{
    if(this.ultraGanttView1.Project.Key == this.ultraGanttView1.Project.Tasks[i].ProjectKey)
    {
        Debug.WriteLine("SAME");
    } else
    {
        Debug.WriteLine("NOT THE SAME");
    }
}

UltraPrintPreviewDialog printPreview = new UltraPrintPreviewDialog();
printPreview.Document = this.ultraGanttViewPrintDocument1;
this.ultraGanttViewPrintDocument1.GanttView = this.ultraGanttView1;
printPreview.ShowDialog(this);//The error comes on this line

Error that I get:

Output that I get in the debugger:

Relation1
Constraint1
Relation1
ProjectKey
ProjectKey
SAME
SAME
'ProjectPlanning.exe' (CLR v4.0.30319: ProjectPlanning.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Infragistics4.Win.UltraWinStatusBar.v17.2\v4.0_17.2.20172.2006__7dd5c3163f2cd0cb\Infragistics4.Win.UltraWinStatusBar.v17.2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Exception thrown: 'System.Data.InvalidConstraintException' in System.Data.dll
An exception of type 'System.Data.InvalidConstraintException' occurred in System.Data.dll but was not handled in user code
ForeignKeyConstraint Relation1 requires the child key values () to exist in the parent table.

Thanks in advance,

Robbe

Parents
  • 29105
    Offline posted

    Hello Robbe,

    Thank you for contacting Infragistics. I have not seen or read any reports of this behavior occurring elsewhere. Which event is this logic handled in?

    You may also want to try swapping lines 28 and 29 before printing.

    eg.
    this.ultraGanttViewPrintDocument1.GanttView = this.ultraGanttView1;
    printPreview.Document = this.ultraGanttViewPrintDocument1;

    I've attached a sample below demonstrating the print preview working with the UltraGantt correctly. Please modify according to your application's specifications and isolate the behavior. I'll review your modifications and investigate this further for you.

    Let me know if you have any questions.

    PrintGanttView.zip

Reply Children