How do I update or delete data on Repeater control using checkboxes?

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.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories