Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

Repeater control checkbox checked event


using VB.net (2005) ASP.net 2.0

I have a repeater control with the item template, in the item template
I have two checkboxes

How to capture event When user checks the checkboxes?  What event
fires on the repeater

Repeater Control Item Template

TextBox
Checkbox1  v
Checkbox2
Label Control

When user checks either of the checkboxes I want to update the label
with new value...

On Jun 6, 9:39 pm, c_shah <shah.chi@netzero.net> wrote:

You need to add an EventHandler in the ItemCreated event of the
repeater

private void Repeater1_ItemCreated(object sender,
RepeaterItemEventArgs e)
{
RepeaterItem ri=(RepeaterItem)e.Item;

if (ri.ItemType==ListItemType.Item ||
ri.ItemType==ListItemType.AlternatingItem)
{
CheckBox cb=ri.FindControl("Checkbox1") as CheckBox;
cb.CheckedChanged +=new EventHandler(CheckedChanged);

}
}

private void CheckedChanged(object sender, EventArgs e)
{
CheckBox cb=(CheckBox)sender;
if (cb.Checked)
...

On Jun 6, 10:52 pm, Alexey Smirnov <alexey.smir@gmail.com> wrote:

> On Jun 6, 9:39 pm, c_shah <shah.chi@netzero.net> wrote:

Sorry, forgot that you have asked for VB

Private Sub Repeater1_ItemCreated(ByVal sender As Object, ByVal e As
RepeaterItemEventArgs)
 Dim ri As RepeaterItem = CType(e.Item, RepeaterItem)
 If ri.ItemType = ListItemType.Item Or ri.ItemType =
ListItemType.AlternatingItem Then
Dim cb As CheckBox = CType(ri.FindControl("Checkbox1"), CheckBox)
AddHandler cb.CheckedChanged, AddressOf Me.CheckedChanged
 End If
End Sub

Private Sub CheckedChanged(ByVal sender As Object, ByVal e As
EventArgs)
 Dim cb As CheckBox = CType(sender, CheckBox)
 If cb.Checked Then
Label1.Text = "Checked"
else
Label1.Text = ""
 End If
End Sub

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc