Nancy Cara
Top achievements
Rank 1
Nancy Cara
asked on 13 Mar 2008, 03:09 AM
I'd like the checkbox field to databind to my IsChecked field in my sqldatasource. Is this possible or do I have to check it OnNodeDataBound in code behind?
4 Answers, 1 is accepted
0
Hi Nancy Cara,
You have to wire the NodeDataBound event and set the Checked property of the TreeNodes in its event handler. Please refer to the following article:
The NodeDataBound event
Hope this helps.
Sincerely yours,
Nick
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You have to wire the NodeDataBound event and set the Checked property of the TreeNodes in its event handler. Please refer to the following article:
The NodeDataBound event
Hope this helps.
Sincerely yours,
Nick
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Nancy Cara
Top achievements
Rank 1
answered on 13 Mar 2008, 03:55 PM
Okay. I'm passing in my IsChecked value in the sqldatasource but see no way to access it in the NodeDataBound event. I have ID, ParentID, Text = Name, and Value = RowID. I see no other place to store a second value for IsChecked. I sure don't want to have to go out and call the database on each node for checked when it's already being passed in with the data. How would I do this.
Database is set up for self-referencing hierarchy:
ID
Name ---> Text
ParentID
RowID ---> Value
Is Checked --> ?? How do I access this on node data bound?
Database is set up for self-referencing hierarchy:
ID
Name ---> Text
ParentID
RowID ---> Value
Is Checked --> ?? How do I access this on node data bound?
0
Accepted
Hi Nancy Cara,
I guess your SQL query is something similar to this:
select Id, Name, RowId, IsChecked from table
Now, in NodeDataBound event handler you can access the database value for the particular node by
as shown in the help article. It does not perform a new query to the database.
Greetings,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I guess your SQL query is something similar to this:
select Id, Name, RowId, IsChecked from table
Now, in NodeDataBound event handler you can access the database value for the particular node by
| ... = (e.Node.DataItem as DataRowView)["IsChecked"].ToString(); |
as shown in the help article. It does not perform a new query to the database.
Greetings,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Nancy Cara
Top achievements
Rank 1
answered on 13 Mar 2008, 04:51 PM
Fantastic! Thank-you Veskoni. You guys are great!
