关闭

绑定数据显示到 GridView

标签: 绑定数据
105人阅读 评论(0) 收藏 举报
分类:
 public void DrugCategoryInit()
        {
            dgvDrugCategoryList.Rows.Clear();
            int DrugCategoryCode=0;                                       //初始化数据
            if (txbDrugCategoryCode.Text == "")
            {
                DrugCategoryCode = 0;
            }
            else
            {
                DrugCategoryCode = Convert.ToInt32(txbDrugCategoryCode.Text);
            }
            int ParentDrugCategory = 0;                                // 初始化数据
            if (txbDrugCategoryCode.Text == "")
            {
                ParentDrugCategory = -1;
            }
            else
            {
                ParentDrugCategory = Convert.ToInt32(txbDrugCategoryCode.Text);
            }
            string categoryName = txbCategoryName.Text;
PageSetInfo psi = DrugCategory.Get(DrugCategoryCode,ParentDrugCategory,categoryName, iPageSize, iCurrPageIndex);
iTotalRecord = psi.TotalRecords;
if (iTotalRecord % iPageSize == 0)
{
iPageCount = iTotalRecord / iPageSize;
}
else
{
iPageCount = iTotalRecord / iPageSize + 1;
}
lbPageMsg.Text = string.Format("当前第{0}页,总共{1}条记录,总共{2}页", iCurrPageIndex, iTotalRecord, iPageCount);
foreach (DrugCategoryInfo info in psi.DrugCategoryInfo)
{
                string pName = "无父类别";                  添加字段
                if (info.ParentDrugCategory > 0)
                {
                    pName = DrugCategory.GetByDrugCategoryCode(info.ParentDrugCategory).CategoryName;  
                }
               
dgvDrugCategoryList.Rows.Add(new object[]{
info.DrugCategoryID,
info.DrugCategoryCode,
info.ParentDrugCategory,
                    info.CategoryName,
pName,
info.Description,
info.Operator,
info.OperateDate,
info.Remark
                 });
            }
        } 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:9031次
    • 积分:333
    • 等级:
    • 排名:千里之外
    • 原创:25篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条