I have Add Child/Update/Delete functionality in the columns of my TreeList. However, I don't want to display Update or Delete on my root node. I expected to do this using the Hidden attribute but my attempt doesn't work. How do I accomplish this?
My failed attempt:
6 Answers, 1 is accepted
You can achieve this requirement by setting a className to this button using the HtmlAttributes (@class):
And the use the dataBound event handler to hide the buttons via script, similar to this implementation:
I hope this will prove helpful.
I'm just getting back to this. As you can see from my example, I use the HtmlHelper. Do you have an example using this approach? I'm looking for the DataBound event and it is not available to me
When I attempt I get this error message:
ErrorCS1061'DataSourceEventBuilder' does not contain a definition for 'DataBound' and no accessible extension method 'DataBound' accepting a first argument of type 'DataSourceEventBuilder' could be found (are you missing a using directive or an assembly reference?)GsiPortalC:\GSI\Gsi.Amtas.Cloud\GsiPortal\Views\GroupsC:\GSI\Gsi.Amtas.Cloud\GsiPortal\Views\Groups\_Hierarchy.cshtml43Active
My Attempt with Errors:
You can resolve this issue by transferring the dataBound event signature from the DataSource to the TreeList definition:
For the column definition you can add the className property:
And then execute your logic using this class name:
That should do the trick.
I am attempting to implement your suggestion. However, the DataBound event does not exist:
My events list the following:
I got this working. My .Events were attached to the .DataSource item and not the Tree. Here is my working example: