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