This is a migrated thread and some comments may be shown as answers.

Edit checkboxes directly and text in a popup EditForm Template

6 Answers 88 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 03 Nov 2011, 07:24 PM

I have a TreeList with text columns and checkbox columns. Is there a way to allow the checkboxes to be clicked and change state in the TreeList and display a popup dialog for text editing?

6 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 08 Nov 2011, 08:27 AM
Hello Paul,

Please examine the Accessing Cells and Items help topic to see how to access the checkboxes.
The RadTreeList provides pop-up editing mode. You can see it here.

I hope this helps.

Greetings,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Paul
Top achievements
Rank 1
answered on 09 Nov 2011, 02:47 PM

I was a bit vague with my question. By allow the checkboxes to be clicked and change state in the TreeList, I meant strictly client side, no AJAX, clicking a checkbox would fire an client-side script where I could change the state of the checkbox and possibly change the enabling/disabling of other checkboxes within the same record.

I found a similar post to mine, but I have not been able to get it to work. I define the TreeList server-side:

 

Dim checkBoxColumn As New TreeListCheckBoxColumn()
tlConfig.Columns.Add(checkBoxColumn)
checkBoxColumn.DataField = “Auditability“
checkBoxColumn.UniqueName = “Auditability”
checkBoxColumn.HeaderText = “Auditability”
checkBoxColumn.HeaderStyle.Width = Unit.Pixel(50)
checkBoxColumn.ReadOnly = False
checkBoxColumn.ItemStyle.CssClass = "centered"

In the ItemDataBound event:
If TypeOf e.Item Is TreeListDataItem Then
    Dim treeListDataItem As TreeListDataItem = CType(e.Item, TreeListDataItem)
    DirectCast(e.Item.FindControl("Auditability"), CheckBox).Attributes("onclick") = _
            [String].Format("return Auditable_onClick('{0}', event);", _
            DirectCast(treeListDataItem.DataItem, ConfigListItem).Index.ToString())
End If


The problem I am having is the “e.Item.FindControl("Auditability")”. When I use VS QuickWatch to examine the available controls, I cannot find Auditability, but I can find clientIDs. Is there a way around this or does not work when the TreeList is define server-side?

0
Mira
Telerik team
answered on 09 Nov 2011, 03:42 PM
Hello Paul,

Please use the following code in order to find the checkboxes and set the onclick event handlers:
If TypeOf e.Item Is TreeListDataItem Then
    Dim treeListDataItem As TreeListDataItem = CType(e.Item, TreeListDataItem)
    DirectCast(treeListDataItem("Auditability").Controls(0), CheckBox).Attributes("onclick") = String.Format("return Auditable_onClick('{0}', event);", _
            DirectCast(treeListDataItem.DataItem, ConfigListItem).Index.ToString())
End If

I hope this helps.

Greetings,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Paul
Top achievements
Rank 1
answered on 09 Nov 2011, 05:08 PM
Thanks for the response Mira.

I tried your code. The function
Auditable_onClick is not being called. Just for the heck of it I tried to reference Controls(1) and get an index out of range, so there is only one control. I also tried changing the [Attributes(“onclick”)] to [Attributes.Add(“onclick”,] with the same result.
0
Accepted
Mira
Telerik team
answered on 11 Nov 2011, 05:30 PM
Hello Paul,

I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

I hope it helps.

All the best,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Paul
Top achievements
Rank 1
answered on 11 Nov 2011, 08:26 PM

Thanks that really helped.

Paul

Tags
TreeList
Asked by
Paul
Top achievements
Rank 1
Answers by
Mira
Telerik team
Paul
Top achievements
Rank 1
Share this question
or