Hi,
I have tried to use your treelist with a template column for displaying a checkbox.
I get the result that the template column is displayed but now I don't know how to get the check event for the checkboxes.
I use the treelist as member of a usercontrol. There will be multiple instances of this usercontrol on the page.
The content of the treeview will be rebuilt completely on Page_Load of the usercontrol.
Don't know what's going wrong here. Hope you'll have a sample for fixing it.
Sincerely
René
I have tried to use your treelist with a template column for displaying a checkbox.
I get the result that the template column is displayed but now I don't know how to get the check event for the checkboxes.
I use the treelist as member of a usercontrol. There will be multiple instances of this usercontrol on the page.
The content of the treeview will be rebuilt completely on Page_Load of the usercontrol.
Don't know what's going wrong here. Hope you'll have a sample for fixing it.
Sincerely
René
'on Page Load of the UserControl
RadTreeList1.Style.Add(HtmlTextWriterStyle.Overflow,
"auto"
)
RadTreeList1.Width = mWidth
RadTreeList1.Height = mHeight
RadTreeList1.EditMode = TreeListEditMode.InPlace
RadTreeList1.Enabled =
True
XmlDataSource1.DataFile = Path &
"RowData.xml"
RadTreeList1.Columns.Clear()
Dim
tmplt
As
New
Web.UI.TemplateBuilder
Dim
selectColumn
As
New
TreeListTemplateColumn
selectColumn.DataField =
"selected"
selectColumn.EditItemTemplate =
New
CheckBoxTemplate(
""
)
selectColumn.ItemTemplate =
New
CheckBoxTemplate(
""
)
RadTreeList1.Columns.Add(selectColumn)
Dim
boundColumn
As
New
TreeListBoundColumn
boundColumn.DataField =
"C2"
boundColumn.UniqueName =
"C2"
boundColumn.HeaderText =
"C2"
RadTreeList1.Columns.Add(boundColumn)
Private
Sub
RadTreeList1_ItemDataBound(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.TreeListItemDataBoundEventArgs)
Handles
RadTreeList1.ItemDataBound
If
TypeOf
e.Item
Is
TreeListDataItem
Then
Dim
dataItem
As
TreeListDataItem = e.Item
Dim
cb
As
Web.UI.WebControls.CheckBox
cb = dataItem.FindControl(
"templateColumnCheckBox"
)
AddHandler
cb.CheckedChanged,
AddressOf
CheckBox1_CheckedChanged
cb.Checked =
True
End
If
End
Sub
Protected
Sub
CheckBox1_CheckedChanged(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
'never get this event....
End
Sub
Public
Class
CheckBoxTemplate
Implements
System.Web.UI.ITemplate
Private
CheckBox
As
System.Web.UI.WebControls.CheckBox
Private
colname
As
String
Public
Sub
New
(
ByVal
cName
As
String
)
colname = cName
End
Sub
Public
Sub
InstantiateIn(
ByVal
container
As
System.Web.UI.Control)
Implements
System.Web.UI.ITemplate.InstantiateIn
CheckBox =
New
System.Web.UI.WebControls.CheckBox
CheckBox.ID =
"templateColumnCheckBox"
CheckBox.AutoPostBack =
True
container.Controls.Add(CheckBox)
End
Sub
End
Class