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

Child Level Items are null

1 Answer 10 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Christine
Top achievements
Rank 1
Veteran
Christine asked on 13 Feb 2016, 03:50 AM

Hi, I am able to select any item in the List and save it Properly, but when I load the page again, what I want is User should be able to see previously selected item as selected rather than selected nothing. For that, it is happening when I select the parent level item but not happening if the selected item is Child.

I am using the below code to retrieve the selected item, as TaxanomyChildIdSelected value would be coming from database and depending upon that value I want to show the user which item has has selected Previously. I am using below code to do that. But FindItemByKeyValue function returns null when I am trying to retrieve the Child level item. Any help a code snippet, link or even suggestion would be very very helpful. Thanks in advance.

 TreeListDataItem item = rtlManageHealthTopics.FindItemByKeyValue("HealthTopicId", TaxanomyChildIdSelected.ToString());
                            if ((item != null) && !DBNull.Value.Equals(item))
                                item.Selected = true;


Below is the full code

WebAdmTopicHealthTopicService _objWebAdmTopicHealthTopicService = new WebAdmTopicHealthTopicService();
                    var _listOfWebAdmTopicHealthTopic = _objWebAdmTopicHealthTopicService.Find(" TopicId= " + _topic.TopicId.ToString());

                    if((_listOfWebAdmTopicHealthTopic!=null) && !DBNull.Value.Equals(_listOfWebAdmTopicHealthTopic) && (_listOfWebAdmTopicHealthTopic.Count>=1))
                    {
                         WebAdmHealthTopicViewService _objWebAdmHealthTopicViewService = new WebAdmHealthTopicViewService();
                         var _listOf_objWebAdmHealthTopicView = _objWebAdmHealthTopicViewService.Get(" HealthTopicId = " + _listOfWebAdmTopicHealthTopic[0].HealthTopicId.ToString() , " Name ");

                        if ((_listOf_objWebAdmHealthTopicView != null) && !DBNull.Value.Equals(_listOf_objWebAdmHealthTopicView) && (_listOf_objWebAdmHealthTopicView.Count() >= 1)
                            && (_listOf_objWebAdmHealthTopicView != null) && (_listOf_objWebAdmHealthTopicView[0].HealthTopicId > 0))
                        {
                            var _objOf_objWebAdmHealthTopicView = _listOf_objWebAdmHealthTopicView[0];
                            TaxanomyChildIdSelected = _listOfWebAdmTopicHealthTopic[0].HealthTopicId;                          
                            
                            TreeListDataItem item = rtlManageHealthTopics.FindItemByKeyValue("HealthTopicId", TaxanomyChildIdSelected.ToString());
                            if ((item != null) && !DBNull.Value.Equals(item))
                                item.Selected = true;                          
                        }                       
                    }

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 17 Feb 2016, 01:30 PM
Hi Christine,

I've already replied in your ticket with ID: 1010191. I suggest that we continue our conversation on the mentioned thread.

Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TreeList
Asked by
Christine
Top achievements
Rank 1
Veteran
Answers by
Eyup
Telerik team
Share this question
or