Gridview中的复选框不起作用 [英] Checkboxes in a Gridview not working

查看:87
本文介绍了Gridview中的复选框不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我的gridview有问题.我有一个创建带有复选框的列的函数,如果第一次加载网格,它会很好地工作,但是如果我在网格中翻页,它将继续填充列.而且,如果我返回首页,则选中的行将取消选中.

我的网格不在回发内填充.

任何建议将不胜感激:-)

此链接是我用于以编程方式添加该列的方法,如果我可以添加该列,则效果很好:< a href ="http://support.microsoft.com/kb/306227"> http://support.microsoft.com /kb/306227</a> [< a href ="http://support.microsoft.com/kb/306227" target ="_ blank" title ="New Window"> ^</a>]

谢谢,

Hi Guys, I have a problem with my gridview. I have a function that creates a column with checkboxes and it works fine if the grid is loaded the first time but if I page through the grid it keeps on populating the column. And if I page back to the first page the rows that I have checked is uncheck.

My grid does not populate within postback.

any suggestion would be appreciated :-)

this link is what I used for programmatically adding the column which work excellent if I might add: <a href="http://support.microsoft.com/kb/306227">http://support.microsoft.com/kb/306227</a>[<a href="http://support.microsoft.com/kb/306227" target="_blank" title="New Window">^</a>]

thanks,

推荐答案

您需要将这些值存储在会话中,并在每次页面加载时进行设置.在代码项目上有文章显示了如何操作.
You need to store those values in the session and set them as each page loads. There''s articles on Code Project that show how.


我自己解决了这个问题,我刚刚将其添加到了gridview中:
I have solved this myself, i just added this to my gridview:
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chbSelectedPanr" runat="server" OnPageIndexChanging="grdDues_PageIndexChanging" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>


这篇关于Gridview中的复选框不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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