|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 30
|
I am trying to display my treeview with the checkboxes that have been checked/unchecked from last visit (stored in the database as true/false). I tried to add the following binding but it is not working.
<eo:DataBinding DataField="RequiredList" Property="Checked" />
Any ideas?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Ben,
Thanks for posting your question here. We will look into it and get back to you as soon as possible.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Ben,
We looked into it and noticed that TreeNode can bind to CheckState property, but not Checked property. So try to change Checked to CheckState should work. The data type can be boolean or integer.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 30
|
I am getting the following error:
Data binding failed on property CheckState. Specified cast is not valid
The value of True is whats coming from the database.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Ben,
I apologize, CheckState takes integer or string, not integer or boolean. When the value is a string, it recognizes "Checked", "Unchecked" and "Indeterminate", when the value is an integer, it recognizes 0, 1 and 2. Even though I think it would make perfect sense to also support boolean.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 30
|
Is it possible to bind the checkstate to a public function returns a valid string based on the bool value?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Ben,
No. But you can handle ItemDataBound event to achieve the same result. Inside ItemDataBound event you will be able to modify the newly data bound tree node based on your data item (access the current data item by "TreeView1.DataItem", which returns an object whose type depends on your data source).
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 5/30/2007 Posts: 30
|
I am still getting the error before ItemDatabound is fired. I verified this debugging.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Ben,
When you use ItemDataBound, you do not use DataBinding object to map the field at all. You set the property by code based on your data source.
Thanks
|
|