|
Rank: Member Groups: Member
Joined: 6/14/2007 Posts: 9
|
I am using a treeView in an ASP.NET 2 application; I want to produce a "read-only" effect, that is, I want to prevent the user from checking, modifying the checkstate of the nodes checkboxes of my treeView; So, I tried to disallow the AllowEdit property (set to "False") of my treeView (See HTML code below). But it doesn't seem to work; When I run my application, I can still check my treenode checkboxes. (NOTE: Since I also need to enable EDIT of my treeView before a postback can occur, I need to reenable it in a Client-Side Script) Question: Is that possible to perform this and if so, how can that be done ?
Essential HTML code of my treeView:
<eo:TreeView ID="tvCategories" runat="server" AllowEdit="False" AllowMultiSelect="True" CausesValidation="True" ClientSideOnContextMenu="ShowContextMenu" ControlSkinID="None" Height="456px" RaisesServerEvent="True" Width="394px" XmlFile="~/Categories.XML"> <LookNodes> <eo:TreeNode AllowEdit="False" CollapsedImageUrl="00030301" ... </eo:TreeNode> </LookNodes> <CheckBoxImages Margin="3" Visible="True" /> <TopGroup AllowEdit="False" ... > <Bindings> <eo:DataBinding Property="Text-Html" DataField="@Name"> </eo:DataBinding> </Bindings> </TopGroup> </eo:TreeView>
I must specify that I use: E.O. Web Controls 2007.1 Microsoft Visual WEB Developer 2005 Version 8 ... (VSVista) Microsoft Windows Vista Family Premium Edition S.P. 1
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi, You will need to handle ClientSideOnCheckStateChanging:
Code: HTML/ASPX
<eo:TreeView ClientSideOnCheckStateChanging="cancel_state_change" ....>
....
</eo:TreeView>
Code: JavaScript
function cancel_state_change()
{
return false;
}
Thanks
|
|
Rank: Member Groups: Member
Joined: 6/14/2007 Posts: 9
|
Well, the cancel_state_change function does work fine without parameter attached to the function, but what if I want to use a parameter to control when I want to disable/enable my read-only behavior? <eo:TreeView ClientSideOnCheckStateChanging="cancel_state_change(1)" ....>
function cancel_state_change(tvEnable) { if (tvEnable == 1) return false; else return true; }
This does not work
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi,
This is only an example to show you how to disable a node when you need to. The function takes a fixed set of parameters provided by the TreeView. You can either use those parameters or ignore them. You can not put out your own. For details you will want to check the reference section in the documentation.
Thanks
|
|