Error: Cannot implicitly convert type 'void' to 'System.Collections.Generic.List'

后端 未结 7 1255
后悔当初
后悔当初 2021-01-07 21:59

I am trying to set a property of my .ascx controls from an .aspx using that control.

So in one of my .aspx which has this control in it, I have the

7条回答
  •  猫巷女王i
    2021-01-07 22:37

    After creating the List you're immediately calling Add on it, which is a method returning void. This cannot be converted to the type of ItemList.ItemList.

    You should do this instead:

    var list = new List();
    list.Add(item);
    ItemList.ItemList = list;
    

提交回复
热议问题