Child Level Items are null

2 posts, 0 answers
  1. Christine
    Christine avatar
    3 posts
    Member since:
    Jul 2013

    Posted 12 Feb Link to this post

    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;                          
                            }                       
                        }

  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 17 Feb Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top