使用(数据)中继器控制的帮助... [英] Help on using (Data) Repeater Control...

查看:42
本文介绍了使用(数据)中继器控制的帮助...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

我正在开发一个小型ASP.NET应用程序.它具有访问者可以在其中发布评论的页面,以及供管理员查看发布的评论的页面.我在(数据)Repeater控件上显示注释,其中每个记录都有两个复选框,以将帖子标记为已读或删除该帖子;将两个enabled属性都设置为true.

为了进行测试,我添加了一个标签来告诉我选中的(复选框)项目.但是每次我选中任何复选框时,都不会得到预期的结果.这是我在Page_Load事件处理程序下的代码隐藏文件:

对于i作为整数= 0到rptPosts.Items.Count-1
将行作为RepeaterItem = rptPosts.Items(i)
Dim isRead为Boolean = CType(row.FindControl("chkRead"),CheckBox).已检查
Dim isDeleted为Boolean = CType(row.FindControl("chkDelete"),CheckBox).
将MessageLabel标记为Label = CType(row.FindControl("lblMessage"),Label)
如果isRead然后
MessageLabel.Text =已读取已检查"
ElseIf被删除,然后
MessageLabel.Text =删除已选中";
如果下一个要结束

请帮帮我.

Hi to every one...

I am developing a small ASP.NET application. It has a page where visitor can post comments, a page for the administrator to view posted comment. I display the comments on a (data) Repeater control with two checkboxes for each record to either mark posts as read or to delete the post; with both enabled property set to true.

For a test, I added a label to tell me the selected (checkbox) item. But each time I check any of the checkboxes, I don't get the expected result. This is my code-behinde file under the Page_Load event handler:

For i As Integer = 0 To rptPosts.Items.Count - 1
Dim row As RepeaterItem = rptPosts.Items(i)
Dim isRead As Boolean = CType(row.FindControl("chkRead"), CheckBox).Checked
Dim isDeleted As Boolean = CType(row.FindControl("chkDelete"), CheckBox).Checked
Dim MessageLabel As Label = CType(row.FindControl("lblMessage"), Label)
If isRead Then
MessageLabel.Text = "Read checked"
ElseIf isDeleted Then
MessageLabel.Text = "Delete checked" 
End If Next

Please help me out.

推荐答案

谢谢您的发帖!我建议您将您的问题发布在 asp .net

 Thank you for your post!  I would suggest please post your question in the forums for asp .net

位于此处: http://forums.asp.net

 located here: http://forums.asp.net

祝你有美好的一天!!!!!

 Have a great day!!!!!


这篇关于使用(数据)中继器控制的帮助...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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