gridview中的绑定列表 [英] binding list in the gridview

查看:65
本文介绍了gridview中的绑定列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个清单

列表< classname> person = new List< classname>();

在此列表中,我有两个人的记录.如果我在该列表中添加新记录,它将仅显示新记录,而不显示现有记录.

但是在(!postback)部分中,当我将列表绑定到gridview时,它显示了两个现有记录,但是在添加新记录后,它仅显示了新记录.

I have a list

List<classname> persons=new List<classname>();

in this list I have records for two persons. If I add a new record in that list it shows only the new record, not the existing records.

but in the (!postback) section when I bind the list to the gridview it shows that two existing records, but after adding the new records it shows only the new.

can anyone find where am committing the mistake.

推荐答案

亲爱的再次使用网格视图绑定列表
dear again bind list with grid view




当您将新记录添加到列表时,请检查列表中是否有2条旧记录.您可以将列表保存在视图状态中,并从viewstate中获取列表,然后向其中添加新记录,然后再次保存在viewstate中.添加检查列表后,检查后有3条记录将此列表绑定到网格视图.现在将显示3条记录.按照此过程,您将找到解决方案. :-)
Hi,

when you are adding new record to list then check that list has 2 old records. you can save list in view state and fetch list from viewstate and add new record to that and again save in viewstate. after adding check list has 3 records after checking bind this list to grid view. it will show 3 records now. follow this process, you will found your solution. :-)


这篇关于gridview中的绑定列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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