简体   繁体   中英

how can I add a column to IQueryable object and modify its values

        var packs = from r in new XPQuery<Roll>(session)
                    select new
                    {
                        Number = r.number
                        Selection = new bool()
                    };
        gcPack.DataSource = packs;

I want to add another column to my grid control with: Selection = new bool(). It will be added to the grid but I can't change its rows' values. How can I add to my grid a column that I can change its values

Simple example for using a non-anonymous class.

public class MyLovelyClass
{
    public Int32 Number { get; set; }
    public bool Selection { get; set; }
}

var packs = from r in new XPQuery<Roll>(session)
            select new MyLovelyClass()
            {
               Number = r.number                
            };
gcPack.DataSource = packs;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM