I have a GridView hierarchy with two child tables, of which I want to show only a few chosen columns .
In Q2, it worked fine with the following code.
In Q2, it worked fine with the following code.
GridViewTableDefinition tdPayment = new GridViewTableDefinition(); |
GridViewTableDefinition tdDetail = new GridViewTableDefinition(); |
tdPayment.DataSource = MySalePayments = GetSalePaymentsData(); |
tdPayment.AutoGenerateFieldDescriptors = false; |
TableRelation tr = new TableRelation(); |
tr.FieldNames.Add(new FieldDescriptorNamePair("Receipt", "Receipt")); |
tdPayment.Relation = tr; |
GridViewDataColumn paymentType = new GridViewDataColumn(); |
paymentType.UniqueName = "SalePaymentType"; |
paymentType.Header = "PaymentType"; |
paymentType.DataType = typeof(short); |
GridViewDataColumn amount = new GridViewDataColumn(); |
amount.UniqueName = "Amount"; |
amount.Header = "Amount"; |
amount.DataType = typeof(decimal); |
tdPayment.FieldDescriptors.Add(paymentType); |
tdPayment.FieldDescriptors.Add(amount); |
tdDetail.AutoGenerateFieldDescriptors = false; |
tdDetail.DataSource = MySaleDetails = GetSaleDetailData(); |
tdDetail.Relation = tr; |
GridViewDataColumn itemId = new GridViewDataColumn(); |
itemId.UniqueName = "ItemId"; |
itemId.Header = "ItemId"; |
itemId.DataType = typeof(string); |
GridViewDataColumn saleQty = new GridViewDataColumn(); |
saleQty.UniqueName = "SaleQuantity"; |
saleQty.Header = "Sale Qty"; |
saleQty.DataType = typeof(short); |
GridViewDataColumn unitPrice = new GridViewDataColumn(); |
unitPrice.UniqueName = "UnitPrice"; |
unitPrice.Header = "Price"; |
unitPrice.DataType = typeof(decimal); |
GridViewDataColumn discount = new GridViewDataColumn(); |
discount.UniqueName = "Discount"; |
discount.Header = "Discount"; |
discount.DataType = typeof(decimal); |
GridViewDataColumn individualDiscount = new GridViewDataColumn(); |
individualDiscount.UniqueName = "IndividualDiscount"; |
individualDiscount.Header = "Ind.Discount"; |
individualDiscount.DataType = typeof(decimal); |
tdDetail.FieldDescriptors.Add(itemId); |
tdDetail.FieldDescriptors.Add(saleQty); |
tdDetail.FieldDescriptors.Add(unitPrice); |
tdDetail.FieldDescriptors.Add(discount); |
tdDetail.FieldDescriptors.Add(individualDiscount); |
radGridViewSalesList.TableDefinition.ChildTableDefinitions.Add(tdPayment); |
radGridViewSalesList.TableDefinition.ChildTableDefinitions.Add(tdDetail); |
When Run in Q3, AutoGenerateFieldDescriptors was simply ignored showing all columns.
In Q3, it was suggested that I use AutoGenerateColumns of GridViewDataControl .
I was able to do it with single child table using DataLoading handler as shown in the demo source code.
But I don't know how to do it with two child tables.