Completed
Last Updated: 21 Jun 2018 13:59 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 25 Apr 2018 08:58
Category: GridView
Type: Bug Report
1
FIX. RadGridView - an error occurs when rebinding the hierarchical grid while the layout is not performed yet
To reproduce: add a grid and a button and use the following code snippet:

[WORKAROUND: call Application.DoEvent at the beginning of the BindGrid method before rebinding]

   public partial class Form1 : Form
    {
        DataTable dtLeg;
        DataTable dtComp;
        DataTable dtClass;
        Int32 intClickCount = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                BindTables();
            }
            catch(Exception)
            {
                throw;
            }


        }

        private void BindTables()
        {
            try
            {
                dtLeg = new DataTable();
                dtComp = new DataTable();
                dtClass = new DataTable();

                Random rand1 = new Random();
                Random rand2 = new Random();
                Random rand3 = new Random();
                Random rand4 = new Random();

                int cNo = rand1.Next(2000, 10000);
                int dID = rand2.Next(2000, 10000);
                int dDetID = rand3.Next(2000, 10000);
                int depCode = rand4.Next(1000, 8000);
                string cCls = "Leg MIAGCM " + depCode.ToString();


                dtLeg.Columns.Add("Case_Number"); dtLeg.Columns.Add("Departure_Detail_Id"); dtLeg.Columns.Add("Departure_Id"); dtLeg.Columns.Add("Cabin_Class"); dtLeg.Columns.Add("Leg_Segment_type"); dtLeg.Columns.Add("Departure_Detail_Capture_Id");
                dtLeg.Columns.Add("DDC_Compartment_Id"); dtLeg.Columns.Add("Compartment_Structure_Id"); dtLeg.Columns.Add("Compartment_Name"); dtLeg.Columns.Add("Compartment_id"); dtLeg.Columns.Add("DDC_Class_Id"); dtLeg.Columns.Add("Class_Structure_Id");
                dtLeg.Columns.Add("Class_Name"); dtLeg.Columns.Add("Class_id"); dtLeg.Columns.Add("DDC_Subclass_Id"); dtLeg.Columns.Add("Subclass_Structure_Id"); dtLeg.Columns.Add("Subclass_Name"); dtLeg.Columns.Add("Subclass_id");
                dtLeg.Columns.Add("Adjusted_Authorizations"); dtLeg.Columns.Add("Adjusted_Availability"); dtLeg.Columns.Add("Adjusted_Bid_Price"); dtLeg.Columns.Add("Adjusted_Boardings"); dtLeg.Columns.Add("Adjusted_Bookings"); dtLeg.Columns.Add("Adjusted_Load_Factor");
                dtLeg.Columns.Add("Adjusted_Physical_Load_Factor"); dtLeg.Columns.Add("Adjusted_Revenue_Gain"); dtLeg.Columns.Add("Adjusted_SCI"); dtLeg.Columns.Add("Authorized_Capacity"); dtLeg.Columns.Add("Average_Fare_Value"); dtLeg.Columns.Add("Booked_Costs");
                dtLeg.Columns.Add("Booked_Revenue"); dtLeg.Columns.Add("Class_Usage_Ratio"); dtLeg.Columns.Add("Confidence"); dtLeg.Columns.Add("Current_Authorizations"); dtLeg.Columns.Add("Current_Availability"); dtLeg.Columns.Add("Current_Bookings");
                dtLeg.Columns.Add("Current_SCI"); dtLeg.Columns.Add("Go_Shows"); dtLeg.Columns.Add("Group_Bookings"); dtLeg.Columns.Add("Group_No_Show_Percentage"); dtLeg.Columns.Add("Limit_Compartment"); dtLeg.Columns.Add("Max_Constraint_Type");
                dtLeg.Columns.Add("Maximum_Authorizations_Constraint"); dtLeg.Columns.Add("Maximum_Leg_Authorization"); dtLeg.Columns.Add("Min_Constraint_Type"); dtLeg.Columns.Add("Minimum_Authorizations_Constraint"); dtLeg.Columns.Add("No_Show_Percentage"); dtLeg.Columns.Add("No_Shows");
                dtLeg.Columns.Add("Overbooking_Amount"); dtLeg.Columns.Add("Overbooking_Cost"); dtLeg.Columns.Add("Physical_Capacity"); dtLeg.Columns.Add("Projected_Authorized_Load_Factor"); dtLeg.Columns.Add("Projected_Boardings"); dtLeg.Columns.Add("Projected_Bookings");
                dtLeg.Columns.Add("Projected_Physical_Load_Factor"); dtLeg.Columns.Add("Projected_Revenue"); dtLeg.Columns.Add("Recommended_Authorized_Load_Factor"); dtLeg.Columns.Add("Recommended_Authorizations"); dtLeg.Columns.Add("Recommended_Availability"); dtLeg.Columns.Add("Recommended_Bid_Price");
                dtLeg.Columns.Add("Recommended_Boardings"); dtLeg.Columns.Add("Recommended_Bookings"); dtLeg.Columns.Add("Recommended_Physical_Load_Factor"); dtLeg.Columns.Add("Recommended_Revenue"); dtLeg.Columns.Add("Recommended_Revenue_Gain"); dtLeg.Columns.Add("Recommended_SCI");
                dtLeg.Columns.Add("Remaining_Cancellations"); dtLeg.Columns.Add("Original_Demand"); dtLeg.Columns.Add("Remaining_Demand"); dtLeg.Columns.Add("Revenue_Target"); dtLeg.Columns.Add("Standard_Deviation"); dtLeg.Columns.Add("Theoretical_Capacity");
                dtLeg.Columns.Add("Total_Booked_Costs"); dtLeg.Columns.Add("Total_Booked_Revenue"); dtLeg.Columns.Add("Total_Group_Bookings"); dtLeg.Columns.Add("Total_Projected_Demand"); dtLeg.Columns.Add("Total_Waitlist"); dtLeg.Columns.Add("Unit_Target");
                dtLeg.Columns.Add("Upsell_Adjusted_Demand"); dtLeg.Columns.Add("Upsell_Authorizations"); dtLeg.Columns.Add("Upsell_Availability"); dtLeg.Columns.Add("Upsell_Boardings"); dtLeg.Columns.Add("Upsell_Bookings"); dtLeg.Columns.Add("Upsell_Probability");
                dtLeg.Columns.Add("Upsell_Revenue"); dtLeg.Columns.Add("Upsell_Revenue_Gain"); dtLeg.Columns.Add("Upsell_SCI"); dtLeg.Columns.Add("Upsell_Remaining_Demand"); dtLeg.Columns.Add("Usage_Ratio"); dtLeg.Columns.Add("Waitlist");
                dtLeg.Columns.Add("Limit_Class"); dtLeg.Columns.Add("rec_limit"); dtLeg.Columns.Add("curr_limit"); dtLeg.Columns.Add("App_Capacity"); dtLeg.Columns.Add("Rec_Capacity"); dtLeg.Columns.Add("Is_Summary");
                dtLeg.Columns.Add("Current_Resource_Limit1"); dtLeg.Columns.Add("Recommand_Resource_Limit1"); dtLeg.Columns.Add("Upsell_Resource_limit1"); dtLeg.Columns.Add("Adjusted_Resource_limit1"); dtLeg.Columns.Add("Current_Resource_Limit2"); dtLeg.Columns.Add("Recommand_Resource_Limit2");
                dtLeg.Columns.Add("Upsell_Resource_limit2"); dtLeg.Columns.Add("Adjusted_Resource_limit2"); dtLeg.Columns.Add("Include_In_Total_Flag"); dtLeg.Columns.Add("Keep_Curr_Auth"); dtLeg.Columns.Add("Discrete_Recomended_Authorization"); dtLeg.Columns.Add("Discrete_Upsell_Authorization");
                dtLeg.Columns.Add("Nesting_Type"); dtLeg.Columns.Add("BookingPickup_DaysPrior_i"); dtLeg.Columns.Add("BookingPickup_Per_DaysPrior_i"); dtLeg.Columns.Add("BookingPickup_DaysPrior_j"); dtLeg.Columns.Add("BookingPickup_Per_DaysPrior_j"); dtLeg.Columns.Add("BookingPickup_DaysPrior_k");
                dtLeg.Columns.Add("BookingPickup_Per_DaysPrior_k"); dtLeg.Columns.Add("SDL_Booked"); dtLeg.Columns.Add("SDL_Booked_Percentage"); dtLeg.Columns.Add("Travelled_Bookings"); dtLeg.Columns.Add("Travelled_Bookings_Percentage"); dtLeg.Columns.Add("PE_Authorization");
                dtLeg.Columns.Add("PE_Availability"); dtLeg.Columns.Add("PE_Booking"); dtLeg.Columns.Add("PE_Boarding"); dtLeg.Columns.Add("PE_Revenue"); dtLeg.Columns.Add("PE_Revenue_Gain"); dtLeg.Columns.Add("Marginal_Fare");
                dtLeg.Columns.Add("Marginal_Demand"); dtLeg.Columns.Add("Price_Elasticity"); dtLeg.Columns.Add("PE_Group_ID"); dtLeg.Columns.Add("PE_Demand"); dtLeg.Columns.Add("Max_Alloc_Hus"); dtLeg.Columns.Add("PAX_Buffer_Hus");
                dtLeg.Columns.Add("PAX_Buffer_Hus_Type"); dtLeg.Columns.Add("Max_Alloc_Berths"); dtLeg.Columns.Add("PAX_Buffer_Berths"); dtLeg.Columns.Add("PAX_Buffer_Berths_Type"); dtLeg.Columns.Add("IS_Sent"); dtLeg.Columns.Add("StepType");
                dtLeg.Columns.Add("Adjusted_Authorizations_Calc"); dtLeg.Columns.Add("SDL_BP_DP_i"); dtLeg.Columns.Add("SDL_BP_DP_j"); dtLeg.Columns.Add("SDL_BP_DP_k"); dtLeg.Columns.Add("current_revenue"); dtLeg.Columns.Add("revenue_SDL");
                dtLeg.Columns.Add("Diff_Bkd_LY"); dtLeg.Columns.Add("Diff_Bkd_SDL"); dtLeg.Columns.Add("Diff_Revenue"); dtLeg.Columns.Add("Max_Booked");

                DataRow drLeg = dtLeg.NewRow();
                drLeg["Case_Number"] = cNo; drLeg["Departure_Detail_Id"] = dDetID; drLeg["Departure_Id"] = dID; drLeg["Cabin_Class"] = cCls; drLeg["Leg_Segment_type"] = "Leg"; drLeg["Departure_Detail_Capture_Id"] = "43824017"; drLeg["DDC_Compartment_Id"] = System.DBNull.Value;
                drLeg["Compartment_Structure_Id"] = System.DBNull.Value; drLeg["Compartment_Name"] = System.DBNull.Value;


                dtLeg.Rows.Add(drLeg);


                dtComp.Columns.Add("Case_Number"); dtComp.Columns.Add("Departure_Detail_Id"); dtComp.Columns.Add("Departure_Id"); dtComp.Columns.Add("Cabin_Class"); dtComp.Columns.Add("Leg_Segment_type"); dtComp.Columns.Add("Departure_Detail_Capture_Id");
                dtComp.Columns.Add("DDC_Compartment_Id"); dtComp.Columns.Add("Compartment_Structure_Id"); dtComp.Columns.Add("Compartment_Name"); dtComp.Columns.Add("Compartment_id"); dtComp.Columns.Add("DDC_Class_Id"); dtComp.Columns.Add("Class_Structure_Id");
                dtComp.Columns.Add("Class_Name"); dtComp.Columns.Add("Class_id"); dtComp.Columns.Add("DDC_Subclass_Id"); dtComp.Columns.Add("Subclass_Structure_Id"); dtComp.Columns.Add("Subclass_Name"); dtComp.Columns.Add("Subclass_id");
                dtComp.Columns.Add("Adjusted_Authorizations"); dtComp.Columns.Add("Adjusted_Availability"); dtComp.Columns.Add("Adjusted_Bid_Price"); dtComp.Columns.Add("Adjusted_Boardings"); dtComp.Columns.Add("Adjusted_Bookings"); dtComp.Columns.Add("Adjusted_Load_Factor");
                dtComp.Columns.Add("Adjusted_Physical_Load_Factor"); dtComp.Columns.Add("Adjusted_Revenue"); dtComp.Columns.Add("Adjusted_Revenue_Gain"); dtComp.Columns.Add("Adjusted_SCI"); dtComp.Columns.Add("Authorized_Capacity"); dtComp.Columns.Add("Average_Fare_Value"); dtComp.Columns.Add("Booked_Costs");
                dtComp.Columns.Add("Booked_Revenue"); dtComp.Columns.Add("Class_Usage_Ratio"); dtComp.Columns.Add("Confidence"); dtComp.Columns.Add("Current_Authorizations"); dtComp.Columns.Add("Current_Availability"); dtComp.Columns.Add("Current_Bookings");
                dtComp.Columns.Add("Current_SCI"); dtComp.Columns.Add("Go_Shows"); dtComp.Columns.Add("Group_Bookings"); dtComp.Columns.Add("Group_No_Show_Percentage"); dtComp.Columns.Add("Limit_Compartment"); dtComp.Columns.Add("Max_Constraint_Type");
                dtComp.Columns.Add("Maximum_Authorizations_Constraint"); dtComp.Columns.Add("Maximum_Leg_Authorization"); dtComp.Columns.Add("Min_Constraint_Type"); dtComp.Columns.Add("Minimum_Authorizations_Constraint"); dtComp.Columns.Add("No_Show_Percentage"); dtComp.Columns.Add("No_Shows");
                dtComp.Columns.Add("Overbooking_Amount"); dtComp.Columns.Add("Overbooking_Cost"); dtComp.Columns.Add("Physical_Capacity"); dtComp.Columns.Add("Projected_Authorized_Load_Factor"); dtComp.Columns.Add("Projected_Boardings"); dtComp.Columns.Add("Projected_Bookings");
                dtComp.Columns.Add("Projected_Physical_Load_Factor"); dtComp.Columns.Add("Projected_Revenue"); dtComp.Columns.Add("Recommended_Authorized_Load_Factor"); dtComp.Columns.Add("Recommended_Authorizations"); dtComp.Columns.Add("Recommended_Availability"); dtComp.Columns.Add("Recommended_Bid_Price");
                dtComp.Columns.Add("Recommended_Boardings"); dtComp.Columns.Add("Recommended_Bookings"); dtComp.Columns.Add("Recommended_Physical_Load_Factor"); dtComp.Columns.Add("Recommended_Revenue"); dtComp.Columns.Add("Recommended_Revenue_Gain"); dtComp.Columns.Add("Recommended_SCI");
                dtComp.Columns.Add("Remaining_Cancellations"); dtComp.Columns.Add("Original_Demand"); dtComp.Columns.Add("Remaining_Demand"); dtComp.Columns.Add("Revenue_Target"); dtComp.Columns.Add("Standard_Deviation"); dtComp.Columns.Add("Theoretical_Capacity");
                dtComp.Columns.Add("Total_Booked_Costs"); dtComp.Columns.Add("Total_Booked_Revenue"); dtComp.Columns.Add("Total_Group_Bookings"); dtComp.Columns.Add("Total_Projected_Demand"); dtComp.Columns.Add("Total_Waitlist"); dtComp.Columns.Add("Unit_Target");
                dtComp.Columns.Add("Upsell_Adjusted_Demand"); dtComp.Columns.Add("Upsell_Authorizations"); dtComp.Columns.Add("Upsell_Availability"); dtComp.Columns.Add("Upsell_Boardings"); dtComp.Columns.Add("Upsell_Bookings"); dtComp.Columns.Add("Upsell_Probability");
                dtComp.Columns.Add("Upsell_Revenue"); dtComp.Columns.Add("Upsell_Revenue_Gain"); dtComp.Columns.Add("Upsell_SCI"); dtComp.Columns.Add("Upsell_Remaining_Demand"); dtComp.Columns.Add("Usage_Ratio"); dtComp.Columns.Add("Waitlist");
                dtComp.Columns.Add("Limit_Class"); dtComp.Columns.Add("rec_limit"); dtComp.Columns.Add("curr_limit"); dtComp.Columns.Add("App_Capacity"); dtComp.Columns.Add("Rec_Capacity"); dtComp.Columns.Add("Is_Summary");
                dtComp.Columns.Add("Current_Resource_Limit1"); dtComp.Columns.Add("Recommand_Resource_Limit1"); dtComp.Columns.Add("Upsell_Resource_limit1"); dtComp.Columns.Add("Adjusted_Resource_limit1"); dtComp.Columns.Add("Current_Resource_Limit2"); dtComp.Columns.Add("Recommand_Resource_Limit2");
                dtComp.Columns.Add("Upsell_Resource_limit2"); dtComp.Columns.Add("Adjusted_Resource_limit2"); dtComp.Columns.Add("Include_In_Total_Flag"); dtComp.Columns.Add("Keep_Curr_Auth"); dtComp.Columns.Add("Discrete_Recomended_Authorization"); dtComp.Columns.Add("Discrete_Upsell_Authorization");
                dtComp.Columns.Add("Nesting_Type"); dtComp.Columns.Add("BookingPickup_DaysPrior_i"); dtComp.Columns.Add("BookingPickup_Per_DaysPrior_i"); dtComp.Columns.Add("BookingPickup_DaysPrior_j"); dtComp.Columns.Add("BookingPickup_Per_DaysPrior_j"); dtComp.Columns.Add("BookingPickup_DaysPrior_k");
                dtComp.Columns.Add("BookingPickup_Per_DaysPrior_k"); dtComp.Columns.Add("SDL_Booked"); dtComp.Columns.Add("SDL_Booked_Percentage"); dtComp.Columns.Add("Travelled_Bookings"); dtComp.Columns.Add("Travelled_Bookings_Percentage"); dtComp.Columns.Add("PE_Authorization");
                dtComp.Columns.Add("PE_Availability"); dtComp.Columns.Add("PE_Booking"); dtComp.Columns.Add("PE_Boarding"); dtComp.Columns.Add("PE_Revenue"); dtComp.Columns.Add("PE_Revenue_Gain"); dtComp.Columns.Add("Marginal_Fare");
                dtComp.Columns.Add("Marginal_Demand"); dtComp.Columns.Add("Price_Elasticity"); dtComp.Columns.Add("PE_Group_ID"); dtComp.Columns.Add("PE_Demand"); dtComp.Columns.Add("Max_Alloc_Hus"); dtComp.Columns.Add("PAX_Buffer_Hus");
                dtComp.Columns.Add("PAX_Buffer_Hus_Type"); dtComp.Columns.Add("Max_Alloc_Berths"); dtComp.Columns.Add("PAX_Buffer_Berths"); dtComp.Columns.Add("PAX_Buffer_Berths_Type"); dtComp.Columns.Add("IS_Sent"); dtComp.Columns.Add("StepType");
                dtComp.Columns.Add("Adjusted_Authorizations_Calc"); dtComp.Columns.Add("SDL_BP_DP_i"); dtComp.Columns.Add("SDL_BP_DP_j"); dtComp.Columns.Add("SDL_BP_DP_k"); dtComp.Columns.Add("current_revenue"); dtComp.Columns.Add("revenue_SDL");
                dtComp.Columns.Add("Diff_Bkd_LY"); dtComp.Columns.Add("Diff_Bkd_SDL"); dtComp.Columns.Add("Diff_Revenue"); dtComp.Columns.Add("Max_Booked"); dtComp.Columns.Add("COMPARTMENT_STRUCTURE_COMPARTMENT_ORDER");

               

                DataRow drComp = dtComp.NewRow();
                drComp["Case_Number"] = cNo; drComp["Departure_Detail_Id"] = dDetID; drComp["Departure_Id"] = dID; drComp["Cabin_Class"] = cCls; drComp["Leg_Segment_type"] = "Leg"; drComp["Departure_Detail_Capture_Id"] = "43824017"; drComp["DDC_Compartment_Id"] = "60513359";
                drComp["Compartment_Structure_Id"] = 4; drComp["Compartment_Name"] = "J"; drComp["Compartment_id"] = 1; drComp["Adjusted_Authorizations"] = 8; drComp["Adjusted_Availability"] = 7; drComp["Adjusted_Boardings"] = 1; drComp["Adjusted_Bookings"] = 1;
                drComp["Adjusted_Load_Factor"] = 0; drComp["Adjusted_Revenue"] = 349; drComp["Current_Authorizations"] = 8; drComp["Current_Availability"] = 7;

                dtComp.Rows.Add(drComp);

                DataRow drComp1 = dtComp.NewRow();
                drComp1["Case_Number"] = cNo; drComp1["Departure_Detail_Id"] = dDetID; drComp1["Departure_Id"] = dID; drComp1["Cabin_Class"] = cCls; drComp1["Leg_Segment_type"] = "Leg"; drComp1["Departure_Detail_Capture_Id"] = "43824017"; drComp1["DDC_Compartment_Id"] = "60513360";
                drComp1["Compartment_Structure_Id"] = 5; drComp1["Compartment_Name"] = "Y"; drComp1["Compartment_id"] = 2; drComp1["Adjusted_Authorizations"] = 114; drComp1["Adjusted_Availability"] = 97; drComp1["Adjusted_Boardings"] = 39; drComp1["Adjusted_Bookings"] = 39;
                drComp1["Adjusted_Load_Factor"] = 0; drComp1["Adjusted_Revenue"] = 350; drComp1["Current_Authorizations"] = 10; drComp1["Current_Availability"] = 10;

                dtComp.Rows.Add(drComp1);

                dtClass.Columns.Add("Case_Number"); dtClass.Columns.Add("Departure_Detail_Id"); dtClass.Columns.Add("Departure_Id"); dtClass.Columns.Add("Cabin_Class"); dtClass.Columns.Add("Leg_Segment_type"); dtClass.Columns.Add("Departure_Detail_Capture_Id");
                dtClass.Columns.Add("DDC_Compartment_Id"); dtClass.Columns.Add("Compartment_Structure_Id"); dtClass.Columns.Add("Compartment_Name"); dtClass.Columns.Add("Compartment_id"); dtClass.Columns.Add("DDC_Class_Id"); dtClass.Columns.Add("Class_Structure_Id");
                dtClass.Columns.Add("Class_Name"); dtClass.Columns.Add("Class_id"); dtClass.Columns.Add("DDC_Subclass_Id"); dtClass.Columns.Add("Subclass_Structure_Id"); dtClass.Columns.Add("Subclass_Name"); dtClass.Columns.Add("Subclass_id");
                dtClass.Columns.Add("Adjusted_Authorizations"); dtClass.Columns.Add("Adjusted_Availability"); dtClass.Columns.Add("Adjusted_Bid_Price"); dtClass.Columns.Add("Adjusted_Boardings"); dtClass.Columns.Add("Adjusted_Bookings"); dtClass.Columns.Add("Adjusted_Load_Factor");
                dtClass.Columns.Add("Adjusted_Physical_Load_Factor"); dtClass.Columns.Add("Adjusted_Revenue"); dtClass.Columns.Add("Adjusted_Revenue_Gain"); dtClass.Columns.Add("Adjusted_SCI"); dtClass.Columns.Add("Authorized_Capacity"); dtClass.Columns.Add("Average_Fare_Value"); dtClass.Columns.Add("Booked_Costs");
                dtClass.Columns.Add("Booked_Revenue"); dtClass.Columns.Add("Class_Usage_Ratio"); dtClass.Columns.Add("Confidence"); dtClass.Columns.Add("Current_Authorizations"); dtClass.Columns.Add("Current_Availability"); dtClass.Columns.Add("Current_Bookings");
                dtClass.Columns.Add("Current_SCI"); dtClass.Columns.Add("Go_Shows"); dtClass.Columns.Add("Group_Bookings"); dtClass.Columns.Add("Group_No_Show_Percentage"); dtClass.Columns.Add("Limit_Compartment"); dtClass.Columns.Add("Max_Constraint_Type");
                dtClass.Columns.Add("Maximum_Authorizations_Constraint"); dtClass.Columns.Add("Maximum_Leg_Authorization"); dtClass.Columns.Add("Min_Constraint_Type"); dtClass.Columns.Add("Minimum_Authorizations_Constraint"); dtClass.Columns.Add("No_Show_Percentage"); dtClass.Columns.Add("No_Shows");
                dtClass.Columns.Add("Overbooking_Amount"); dtClass.Columns.Add("Overbooking_Cost"); dtClass.Columns.Add("Physical_Capacity"); dtClass.Columns.Add("Projected_Authorized_Load_Factor"); dtClass.Columns.Add("Projected_Boardings"); dtClass.Columns.Add("Projected_Bookings");
                dtClass.Columns.Add("Projected_Physical_Load_Factor"); dtClass.Columns.Add("Projected_Revenue"); dtClass.Columns.Add("Recommended_Authorized_Load_Factor"); dtClass.Columns.Add("Recommended_Authorizations"); dtClass.Columns.Add("Recommended_Availability"); dtClass.Columns.Add("Recommended_Bid_Price");
                dtClass.Columns.Add("Recommended_Boardings"); dtClass.Columns.Add("Recommended_Bookings"); dtClass.Columns.Add("Recommended_Physical_Load_Factor"); dtClass.Columns.Add("Recommended_Revenue"); dtClass.Columns.Add("Recommended_Revenue_Gain"); dtClass.Columns.Add("Recommended_SCI");
                dtClass.Columns.Add("Remaining_Cancellations"); dtClass.Columns.Add("Original_Demand"); dtClass.Columns.Add("Remaining_Demand"); dtClass.Columns.Add("Revenue_Target"); dtClass.Columns.Add("Standard_Deviation"); dtClass.Columns.Add("Theoretical_Capacity");
                dtClass.Columns.Add("Total_Booked_Costs"); dtClass.Columns.Add("Total_Booked_Revenue"); dtClass.Columns.Add("Total_Group_Bookings"); dtClass.Columns.Add("Total_Projected_Demand"); dtClass.Columns.Add("Total_Waitlist"); dtClass.Columns.Add("Unit_Target");
                dtClass.Columns.Add("Upsell_Adjusted_Demand"); dtClass.Columns.Add("Upsell_Authorizations"); dtClass.Columns.Add("Upsell_Availability"); dtClass.Columns.Add("Upsell_Boardings"); dtClass.Columns.Add("Upsell_Bookings"); dtClass.Columns.Add("Upsell_Probability");
                dtClass.Columns.Add("Upsell_Revenue"); dtClass.Columns.Add("Upsell_Revenue_Gain"); dtClass.Columns.Add("Upsell_SCI"); dtClass.Columns.Add("Upsell_Remaining_Demand"); dtClass.Columns.Add("Usage_Ratio"); dtClass.Columns.Add("Waitlist");
                dtClass.Columns.Add("Limit_Class"); dtClass.Columns.Add("rec_limit"); dtClass.Columns.Add("curr_limit"); dtClass.Columns.Add("App_Capacity"); dtClass.Columns.Add("Rec_Capacity"); dtClass.Columns.Add("Is_Summary");
                dtClass.Columns.Add("Current_Resource_Limit1"); dtClass.Columns.Add("Recommand_Resource_Limit1"); dtClass.Columns.Add("Upsell_Resource_limit1"); dtClass.Columns.Add("Adjusted_Resource_limit1"); dtClass.Columns.Add("Current_Resource_Limit2"); dtClass.Columns.Add("Recommand_Resource_Limit2");
                dtClass.Columns.Add("Upsell_Resource_limit2"); dtClass.Columns.Add("Adjusted_Resource_limit2"); dtClass.Columns.Add("Include_In_Total_Flag"); dtClass.Columns.Add("Keep_Curr_Auth"); dtClass.Columns.Add("Discrete_Recomended_Authorization"); dtClass.Columns.Add("Discrete_Upsell_Authorization");
                dtClass.Columns.Add("Nesting_Type"); dtClass.Columns.Add("BookingPickup_DaysPrior_i"); dtClass.Columns.Add("BookingPickup_Per_DaysPrior_i"); dtClass.Columns.Add("BookingPickup_DaysPrior_j"); dtClass.Columns.Add("BookingPickup_Per_DaysPrior_j"); dtClass.Columns.Add("BookingPickup_DaysPrior_k");
                dtClass.Columns.Add("BookingPickup_Per_DaysPrior_k"); dtClass.Columns.Add("SDL_Booked"); dtClass.Columns.Add("SDL_Booked_Percentage"); dtClass.Columns.Add("Travelled_Bookings"); dtClass.Columns.Add("Travelled_Bookings_Percentage"); dtClass.Columns.Add("PE_Authorization");
                dtClass.Columns.Add("PE_Availability"); dtClass.Columns.Add("PE_Booking"); dtClass.Columns.Add("PE_Boarding"); dtClass.Columns.Add("PE_Revenue"); dtClass.Columns.Add("PE_Revenue_Gain"); dtClass.Columns.Add("Marginal_Fare");
                dtClass.Columns.Add("Marginal_Demand"); dtClass.Columns.Add("Price_Elasticity"); dtClass.Columns.Add("PE_Group_ID"); dtClass.Columns.Add("PE_Demand"); dtClass.Columns.Add("Max_Alloc_Hus"); dtClass.Columns.Add("PAX_Buffer_Hus");
                dtClass.Columns.Add("PAX_Buffer_Hus_Type"); dtClass.Columns.Add("Max_Alloc_Berths"); dtClass.Columns.Add("PAX_Buffer_Berths"); dtClass.Columns.Add("PAX_Buffer_Berths_Type"); dtClass.Columns.Add("IS_Sent"); dtClass.Columns.Add("StepType");
                dtClass.Columns.Add("Adjusted_Authorizations_Calc"); dtClass.Columns.Add("SDL_BP_DP_i"); dtClass.Columns.Add("SDL_BP_DP_j"); dtClass.Columns.Add("SDL_BP_DP_k"); dtClass.Columns.Add("current_revenue"); dtClass.Columns.Add("revenue_SDL");
                dtClass.Columns.Add("Diff_Bkd_LY"); dtClass.Columns.Add("Diff_Bkd_SDL"); dtClass.Columns.Add("Diff_Revenue"); dtClass.Columns.Add("Max_Booked"); dtClass.Columns.Add("COMPARTMENT_STRUCTURE_COMPARTMENT_ORDER");


                DataRow drClass = dtClass.NewRow();
                drClass["Case_Number"] = cNo; drClass["Departure_Detail_Id"] = dDetID; drClass["Departure_Id"] = dID; drClass["Cabin_Class"] = cCls; drClass["Leg_Segment_type"] = "Leg"; drClass["Departure_Detail_Capture_Id"] = "43824017"; drClass["DDC_Compartment_Id"] = "60513360";
                drClass["Compartment_Structure_Id"] = 5; drClass["Compartment_Name"] = "Y"; drClass["Compartment_id"] = 2; drClass["DDC_Class_Id"] = "6022025"; drClass["Class_Structure_Id"] = 4;
                drClass["Class_Name"] = "Y"; drClass["Class_id"] = 4; drClass["Adjusted_Authorizations"] = 8; drClass["Adjusted_Availability"] = 7; drClass["Adjusted_Boardings"] = 1; drClass["Adjusted_Bookings"] = 1;
                drClass["Adjusted_Load_Factor"] = 0; drClass["Adjusted_Revenue"] = 349; drClass["Current_Authorizations"] = 8; drClass["Current_Availability"] = 7;

                dtClass.Rows.Add(drClass);

                DataRow drClass1 = dtClass.NewRow();
                drClass1["Case_Number"] = cNo; drClass1["Departure_Detail_Id"] = dDetID; drClass1["Departure_Id"] = dID; drClass1["Cabin_Class"] = cCls; drClass1["Leg_Segment_type"] = "Leg"; drClass1["Departure_Detail_Capture_Id"] = "43824017"; drClass1["DDC_Compartment_Id"] = "60513359";
                drClass1["Compartment_Structure_Id"] = 4; drClass1["Compartment_Name"] = "J"; drClass1["Compartment_id"] = 1; drClass1["DDC_Class_Id"] = "6022020"; drClass1["Class_Structure_Id"] = 1;
                drClass1["Class_Name"] = "J"; drClass1["Class_id"] = 1; drClass1["Adjusted_Authorizations"] = 8; drClass1["Adjusted_Availability"] = 7; drClass1["Adjusted_Boardings"] = 1; drClass1["Adjusted_Bookings"] = 1;
                drClass1["Adjusted_Load_Factor"] = 0; drClass1["Adjusted_Revenue"] = 349; drClass1["Current_Authorizations"] = 8; drClass1["Current_Availability"] = 7;

                dtClass.Rows.Add(drClass1);

                DataRow drClass2 = dtClass.NewRow();
                drClass2["Case_Number"] = cNo; drClass2["Departure_Detail_Id"] = dDetID; drClass2["Departure_Id"] = dID; drClass2["Cabin_Class"] = cCls; drClass2["Leg_Segment_type"] = "Leg"; drClass2["Departure_Detail_Capture_Id"] = "43824017"; drClass2["DDC_Compartment_Id"] = "60513359";
                drClass2["Compartment_Structure_Id"] = 4; drClass2["Compartment_Name"] = "J"; drClass2["Compartment_id"] = 1; drClass2["DDC_Class_Id"] = "6022020"; drClass2["Class_Structure_Id"] = 17;
                drClass2["Class_Name"] = "C"; drClass2["Class_id"] = 17; drClass2["Adjusted_Authorizations"] = 8; drClass2["Adjusted_Availability"] = 7; drClass2["Adjusted_Boardings"] = 1; drClass2["Adjusted_Bookings"] = 1;
                drClass2["Adjusted_Load_Factor"] = 0; drClass2["Adjusted_Revenue"] = 349; drClass2["Current_Authorizations"] = 8; drClass2["Current_Availability"] = 7;

                dtClass.Rows.Add(drClass2);


                BindGrid();
            }
            catch(Exception)
            {
                throw;
            }
        }

        private void BindGrid()
        {
            try
            {

                radGridWorksheet.MasterTemplate.Templates.Clear();
                radGridWorksheet.Relations.Clear();
                radGridWorksheet.DataSource = dtLeg;
                radGridWorksheet.AllowAddNewRow = false;
                radGridWorksheet.AllowDeleteRow = false;
                radGridWorksheet.AllowEditRow = true;
                radGridWorksheet.AutoGenerateColumns = true;
                radGridWorksheet.BestFitColumns();
                radGridWorksheet.GridViewElement.DrawBorder = false;
                radGridWorksheet.GridViewElement.GroupPanelElement.DrawBorder = false;

                GridViewTemplate childDetailCaptureDate = new GridViewTemplate();
                childDetailCaptureDate.Caption = "Leg";
                childDetailCaptureDate.Columns.Clear();
                childDetailCaptureDate.AllowAddNewRow = false;
                childDetailCaptureDate.AllowDeleteRow = false;
                childDetailCaptureDate.AllowEditRow = true;
                childDetailCaptureDate.AutoGenerateColumns = true;
                childDetailCaptureDate.BestFitColumns();
                childDetailCaptureDate.DataSource = dtComp;
                radGridWorksheet.MasterTemplate.Templates.Add(childDetailCaptureDate);
                GridViewRelation relationCaptureDate = new GridViewRelation(radGridWorksheet.MasterTemplate);
                relationCaptureDate.ChildTemplate = childDetailCaptureDate;
                relationCaptureDate.RelationName = "Capture";
                relationCaptureDate.ParentColumnNames.Add("Departure_Detail_Capture_Id");
                relationCaptureDate.ChildColumnNames.Add("Departure_Detail_Capture_Id");
                radGridWorksheet.Relations.Add(relationCaptureDate);

                GridViewTemplate childDetailCaptureDateComp = new GridViewTemplate();
                childDetailCaptureDateComp.Caption = "Comp";
                childDetailCaptureDateComp.Columns.Clear();
                childDetailCaptureDateComp.AllowAddNewRow = false;
                childDetailCaptureDateComp.AllowDeleteRow = false;
                childDetailCaptureDateComp.AllowEditRow = true;
                childDetailCaptureDateComp.AutoGenerateColumns = true;
                childDetailCaptureDateComp.BestFitColumns();
                childDetailCaptureDateComp.DataSource = dtClass;
                childDetailCaptureDate.Templates.Add(childDetailCaptureDateComp);
                GridViewRelation relationCaptureDateCompatment = new GridViewRelation(childDetailCaptureDate);
                relationCaptureDateCompatment.ChildTemplate = childDetailCaptureDateComp;
                relationCaptureDateCompatment.RelationName = "Compartment";
                relationCaptureDateCompatment.ParentColumnNames.Add("DDC_Compartment_Id");
                relationCaptureDateCompatment.ChildColumnNames.Add("DDC_Compartment_Id");
                radGridWorksheet.Relations.Add(relationCaptureDateCompatment); 

                radGridWorksheet.MasterTemplate.ExpandAll();

            }
            catch(Exception e0)
            { 
                MessageBox.Show(String.Format("{0}\n{1}", e0.Message, e0.StackTrace));
                throw;

            }
        }

        private void radButton1_Click(object sender, EventArgs e)
        {
            try
            {
                intClickCount = intClickCount + 1;
                //Thread.Sleep(1000);
                radButton1.Text = "Next Click " + intClickCount;
                BindTables();
            }
            catch(Exception e0)
            { 
                MessageBox.Show(String.Format("{0}\n{1}", e0.Message, e0.StackTrace));
                throw;

            }

        }
    }
0 comments