Hi,
I have listview that works well with the definition below:
<
telerik:RadListView
ID
=
"lvwUserGroups"
runat
=
"server"
ItemPlaceholderID
=
"groupsPlaceholder"
OnNeedDataSource
=
"lvwUserGroups_NeedDataSource"
DataKeyNames
=
"GroupID"
>
<
LayoutTemplate
>
<
div
class="RadListView RadListView_<%# Master.SkinManager.Skin %>" >
<
table
class
=
"mainTable"
>
<
thead
>
<
tr
class
=
"rlvHeader"
>
<
th
class
=
"thcenter"
>Enabled</
th
>
<
th
>Group</
th
>
</
tr
>
</
thead
>
<
tbody
>
<
asp:PlaceHolder
id
=
"groupsPlaceholder"
runat
=
"server"
>
</
asp:PlaceHolder
>
</
tbody
>
</
table
>
</
div
>
</
LayoutTemplate
>
</
telerik:RadListView
>
protected
class
userGRPTemplate : ITemplate
{
private
ADScrubWeb.HTMLHelper helper =
new
ADScrubWeb.HTMLHelper();
public
userGRPTemplate()
{
}
public
void
InstantiateIn(Control container)
{
TableRow tr =
new
TableRow();
container.Controls.Add(tr);
helper.AddControlToParent(container, helper.AddBoundHiddenField(
"GroupID"
));
helper.AddControlToParent(tr, helper.AddBoundCheckBox(
"Enabled"
),
true
, HorizontalAlign.Center);
helper.AddControlToParent(tr, helper.AddBoundTextBox(
"GroupName"
, BorderStyle.None,
true
),
true
, HorizontalAlign.Left);
}
}
public
CheckBox AddBoundCheckBox(
string
controlID)
{
CheckBox tmp =
new
CheckBox();
tmp.ID = controlID;
tmp.DataBinding +=
delegate
(
object
sender, EventArgs args)
{
CheckBox control = ((CheckBox)sender);
RadListViewDataItem listViewDataItem = ((RadListViewDataItem)control.NamingContainer);
control.Checked = lsuGeneral.IsTrue(DataBinder.Eval(listViewDataItem.DataItem, controlID).ToString());
};
return
tmp;
}
I would like to react to the user clicking the bound checkbox so I can do auto-updates without the user clicking an update button. I tried wiring up the checkbox CheckedChange event in the ITemplate but that didn't fire, anyway I would still need to know which row's checkbox was clicked.
Any ideas?