We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

UnboundField Sort and group

below code is in TableDescriptor_QueryValue method, "YTD" is a unboundfield, "YTDtmp" is a boundcolumn, when I sort or group by "YTD" column, there is no data in gridGroupingControl,why, can u give me a solution to resolve it? ------------------- int row = e.Record.ParentChildTable.Records.IndexOf(e.Record); if (e.Field.Name == "YTD" ) { GridRecord rec = e.Record.ParentChildTable.Records[row] as GridRecord; if((int)rec.GetValue("ValType")==3) { GridRecord rec1 = e.Record.ParentChildTable.Records[row-1] as GridRecord; GridRecord rec2 = e.Record.ParentChildTable.Records[row-2] as GridRecord; if (Double.Parse(rec2.GetValue("YTDtmp").ToString())>0) { e.Value = Double.Parse( rec1.GetValue("YTDtmp").ToString()) / Double.Parse(rec2.GetValue("YTDtmp").ToString()); } } }

3 Replies

AD Administrator Syncfusion Team July 20, 2005 06:46 PM UTC

If you do not sort or group, do all the values appear as you expect? When you say there is no data in teh grid, do you mean all cells are empty or only the unbound column? What version are you using? Do you see any exceptions being listed in your output window? When you step through this event, is the if statement ever true? What value do you want to see in the unbound column when the if statement is not true? Here is a little sample that seems to work OK. http://www.syncfusion.com/Support/user/uploads/GGC_Unbound_e66bac30.zip


AD Administrator Syncfusion Team July 21, 2005 03:08 AM UTC

When i using you demo(I have modified it to 2.0.5.1),there is no data in unbound field,My version is 2.0.5.1: if i do not sort or group,everything is ok,if group using other boundcolumn,have System.ArgumentOutOfRangeException at this row: GridRecord rec = e.Record.ParentChildTable.Records[row] as GridRecord;(in QueryValue method) if i sort or group using unboundfield,i can just see columnheader without any exceptions out,and groupingcontrol is unusable. //i have a boundcolumn "YTDtemp", //a unboundfield "YTD", //e.g: //ValType YTDtemp YTD //1 10 10 //2 5 5 //3 3 5/10 //when ValType=1 or 2:YTD=YTDtemp //when ValType=3:YTD=YTDtemp(ValType=2)/YTDtemp(ValType=1)/ below is my code: private void TableDescriptor_QueryValue(object sender, FieldValueEventArgs e) { int row = e.Record.ParentChildTable.Records.IndexOf(e.Record); if (e.Field.Name == "YTD" ) { GridRecord rec = e.Record.ParentChildTable.Records[row] as GridRecord; if((int)rec.GetValue("ValType")==3) { GridRecord rec1 = e.Record.ParentChildTable.Records[row-1] as GridRecord; GridRecord rec2 = e.Record.ParentChildTable.Records[row-2] as GridRecord; if (Double.Parse(rec2.GetValue("YTDtmp").ToString())>0) { e.Value = Double.Parse( rec1.GetValue("YTDtmp").ToString()) / Double.Parse(rec2.GetValue("YTDtmp").ToString()); } } } } >If you do not sort or group, do all the values appear as you expect? > >When you say there is no data in teh grid, do you mean all cells are empty or only the unbound column? > >What version are you using? > >Do you see any exceptions being listed in your output window? > >When you step through this event, is the if statement ever true? What value do you want to see in the unbound column when the if statement is not true? > >Here is a little sample that seems to work OK. > >http://www.syncfusion.com/Support/user/uploads/GGC_Unbound_e66bac30.zip >


AD Administrator Syncfusion Team July 21, 2005 04:04 AM UTC

hi,Thanks Stefan, I have resolved it, at first,i assign double type value to e.value, now i assign string type value to e.value, i''s ok. Thanks a lot!

Loader.
Live Chat Icon For mobile
Up arrow icon