0

Is it possible to convert IEnumerable to DataSet?

I have this repeater that I suspect needs to be a DataSet for it to find the Eval column of the table. Here is my code:

C#:

    var node = _administrationSystem.GetNodes(); //DataSet
    var operatorInfo = _administrationSystem.GetOperatorsInformation(userId); //DataSet

    var result = from nodes in node.Tables[0].AsEnumerable().ToList()
                 join operators in operatorInfo.Tables[0].AsEnumerable().ToList()
                 on nodes.Field<int>("NodeIndex") equals operators.Field<int>("NodeIndex")
                 select new {nodes, operators}; //IEnumerable

    rptList.DataSource = result; //The repeater. I get exception in ASPX that cannot find proper data.
    rptList.DataBind();

I get the following exception:

"Additional information: DataBinding: '<>f__AnonymousType0`2[[System.Data.DataRow, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Data.DataRow, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' does not contain a property with the name 'FirstName'."

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Malphai
  • 307
  • 3
  • 6
  • 21
  • I doubt the exception message is "cannot find proper data.". Don't you understand that we can't help you unless you provide the *actual exception type and its message*? – rory.ap Mar 01 '17 at 12:29
  • Yes I understand, what don't you understand? The exception is not the solution of the problem but here you go anyway: "Additional information: DataBinding: '<>f__AnonymousType0`2[[System.Data.DataRow, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Data.DataRow, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' does not contain a property with the name 'FirstName'." – Malphai Mar 01 '17 at 12:37
  • Don't put substantive information in the comments section. Edit your question and properly format it. – rory.ap Mar 01 '17 at 12:50
  • I have updated my question. – Malphai Mar 01 '17 at 13:38

0 Answers0