Dynamic Row Selection

Jan 8, 2014 at 5:08 PM
I'm sorry if my question appears to be silly.. Kindly Help...

In the below code,
public ActionResult SampleDownload1()
            var records = _getSampleInfoQuery.Execute();
                        var columns = new[]
                                  Column(x => x.College),
                                  Column(x => x.Amount, ExcelFormat.Money),
                                  Column(x => x.CreatedDate, ExcelFormat.Date, "Date"),
                                  Column(x => x.CreatedBy),
                                  Column(x => x.CreatedDate, ExcelFormat.Time, "Time"),
                                  Column(x => x.PercentageExample, ExcelFormat.Percent),
            return new ExcelFileResult<SampleInfo>(records) {ColumnDefinitions = columns};
I would like the user to specify the list of columns to be added to Var columns.

I would probably be passing array of IDs (or anything else?) of the chosen column like College,Amount,PercentageExample, the downloaded excel should contain only those columns.

Note sure whether i am putting my question in right. Let me know for any clarifications.

Thanks for your precious time Smile | :)
Jan 8, 2014 at 9:53 PM
Edited Jan 8, 2014 at 10:49 PM
Have put together a working example as well near your reality.

There is some form of solving the problem.
With this example failing to understand.

look link > http://stackoverflow.com/questions/16516971/linq-dynamic-select
or http://stackoverflow.com/questions/4214881/using-lambda-expression-to-select-different-fields-from-field-names
Jan 9, 2014 at 1:40 AM
Thanks leonardoFiorot