Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
4695
Ultragrid Datasource = List<>
posted

Dear All,

I have below code. But there is no record shown in the ultragrid and cannot find the List variable "SKU"  in the header.Caption. Do you know why? I am sure that there is record in result list.

List<StoreServer.VO.ValueCard.ValueCardRemainValueVO> result = new List<StoreServer.VO.ValueCard.ValueCardRemainValueVO>();
               this.ultraGrid1.DataSource = result;

this.ultraGrid1.DisplayLayout.Bands[0].Columns["SKU"].Header.Caption
                    = Reports.GUI.ResMgr.ResManager.GetString("dtgHeader_SKU");
               

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    I don't understand your question. The code you have here is binding the grid to an empty list. So there are no rows in the grid because there are not rows in the DataSource because you never added any.

    I'm not sure what you mean by "cannot find the List variable "SKU"  in the header.Caption". Are you getting an error of some kind? What's the error?

    If trying to access the "SKU" column raises an exception, then it could be because your data object is not exposing a public property called SKU. Or it could be because you are using a List<T> with no items in it and the BindingManager is unable to retrieve the data structure.

    List<T> is not a great data source to use since IList is not designed for data binding. Using a List<T> will give you limited functionality in the grid. You might be better of with BindingList<T>.

Children
No Data