如何在datagrid行中显示实体列表值 [英] how to diplay entity list values in datagrid rows

查看:112
本文介绍了如何在datagrid行中显示实体列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Purchasefecade facade = new Purchasefecade();
List<purchaseentity> entityList = facade.GetPurchase(Convert.ToString(TxtpurNo.Text.Trim()));
if (entityList != null && entityList.Count > 0)
{
   foreach (PurchaseEntity entity1 in entityList)
   {
      dgv.Rows.Add(new object[] { 
         entity1.ProductId, entity1.PRoductName, entity1.Packing, entity1.BatchNo,
         entity1.PurPrice, entity1.Qty, entity1.Free, entity1.Margin, 
         entity1.ExpiryDate, entity1.ExDuty, entity1.AdTax, entity1.CSTAmnt, 
         entity1.PVatPer, entity1.SalesDiscPer, entity1.SalesPrice, entity1.BatchId,
         entity1.DiscPersentage, entity1.SVatPer, entity1.MRP, entity1.PurChaseId});
   }
}



这里

如何在数据网格行中显示上述值

喜欢


here
how to display above values in datagrid rows
like

datagrid.Rows[i].Cells[0]=entity1.ProductId;



没有得到请帮助我..


am not getting please help me..

推荐答案

这是简单的尝试以下代码



It's simple try following code

Gridview.DataSource = your entitiy list object 
Gridview.DataBind()





希望我的解决方案适合您



Hope my solution will work for you


这篇关于如何在datagrid行中显示实体列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆