Infragistics Ultra Grid DataRelation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sarahb1337
    New Member
    • Feb 2007
    • 2

    Infragistics Ultra Grid DataRelation

    Hi all,
    I have two tables that I'm trying to display in a Master Detail fashion in an Infragistics UltraGrid. I added both tables to a dataset and added a datarelation between the two tables using the field that related both. When I run my application Ultra Grid just displays the master table, the child table is not displayed. Does anybody know what is wrong with my code? Grid expandable property is set to true, but is there any other property that I need to set to be able to see the chid table? Thanks for the help.


    Code:
                string sqlCommand = "";
                sqlCommand = "SELECT * FROM ENUM_VALUES";
                DataTable dt2 =                     
                DBBroker.getInstance().ExecuteSQL(sqlCommand);
                
                sqlCommand = "SELECT * FROM CONSTANTS";
                DataTable dt1 = 
                DBBroker.getInstance().ExecuteSQL(sqlCommand);
                
                DataSet ds = new DataSet();
              
                ds.Tables.Add(dt1); //Add master table
                ds.Tables.Add(dt2);  // Add child table
    
                DataRelation relConstEnum = new DataRelation("ConstEnum",    
                    ds.Tables[0].Columns["ID"],                     
                    ds.Tables[1].Columns["CONST_ID"], false);
                ds.Relations.Add(relConstEnum);
                
                mGrid.Rows.ExpandAll(true);
                mGrid.DataSource = ds;
    Last edited by kenobewan; Feb 21 '07, 01:20 PM. Reason: Add code tags
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    I believe that the problem is the you need two separate sql strings and execute them separately. Otherwise the first string is written over by the second...

    Comment

    • Sarahb1337
      New Member
      • Feb 2007
      • 2

      #3
      I found out what was the problem. UltraGrid ViewStyle property has to be set to MultiBand instead of SingleBand.

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        My bad, using the same sqlcommand name was very confusing for me :).

        Comment

        Working...