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

Can't get textItemValue back from Treeview

2 Answers 42 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Craig Tarp
Top achievements
Rank 1
Craig Tarp asked on 04 Jun 2010, 09:16 PM
Hi All,

While watching model load the page I can see the Id populate the Item value
but then when I go to check it   alert("Selected - " + treeView().getItemValue(e.item)); 

I am only getting the Item text ( title )...( I need the Id as I am editiing the Title on the fly) ..... 

Am I doing something wrong ?   and If not ....Is there a work around??

item.Value = unit.Id.ToString(); 

 
.BindTo(Model.Units, mappings => 
                {  
                    mappings.For<XP.Models.CustomClasses.Unit>(binding => binding                  
                   .ItemDataBound((item, unit) =>   
                                      {                                           
                                          item.Text = unit.Title;  
                                          item.Value = unit.Id.ToString();       
                                          item.ImageUrl = "../../Images/unit32.png";                                              
                                      })  
                   .Children(unit => unit.Lessons));  
 
                    mappings.For<XP.Models.CustomClasses.Lesson>(binding => binding                      
                   .ItemDataBound((item, lesson) => 
                                      {  
                                          item.Text = lesson.Title;  
                                          item.Value = lesson.Id.ToString();  
                                          item.ImageUrl = "../../Images/lesson32.png";  
                                      })  
                    .Children(lesson => lesson.Sections));  
 
                    mappings.For<XP.Models.CustomClasses.Section>(binding => binding                    
                   .ItemDataBound((item, section) => 
                                   {  
                                       item.Text = section.Title;  
                                       item.Value = section.Id.ToString();  
                                       item.ImageUrl = "../../Images/section32.png";  
                                   })  
               .Children(section => null));  
                }).HtmlAttributes(new { @class = "t-group" }) 





Regards      Craig  T.......

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 Jun 2010, 06:53 AM
Hello Craig Tarp,

When and how do you check the value? This is not clear based on the provided source code. Could you send us the complete source code? Ideally you could send us a sample project. Since code attachments are allowed only in support tickets you can host your project using a public file sharing web site e.g. mediafire.com, dropbox.com etc.

Regards,
Atanas Korchev
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Craig Tarp
Top achievements
Rank 1
answered on 07 Jun 2010, 04:15 PM
Atanas

thankyou for your timely response, I found the error of my ways

Regards,

Craig
Tags
TreeView
Asked by
Craig Tarp
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Craig Tarp
Top achievements
Rank 1
Share this question
or