Problem With Object Data Source

3 posts, 0 answers
  1. Ahmed
    Ahmed avatar
    2 posts
    Member since:
    Feb 2009

    Posted 24 Mar 2009 Link to this post

    i face aproblem when i try to make tree view bind from object data source
    here it is my class

    public

    class treeViewClass

     {

     

     

    #region

    Variables

     

     

    int _FiledId;

     

     

    string _Value;

     

     

    int? _ParentId;

     

     

    string _FieldText;

     

     

    string _FieldURL;

     

     

    #endregion

    #region

    Properties

     

     

    public int FiledId

    {

     

    get { return _FiledId; }

     

    set { _FiledId = value; }

     

     }

     

    public int? ParentId

     

     {

     

    get { return _ParentId; }

     

     

    set { _ParentId = value; }

     

     }

     

    public string FieldText

     

     {

     

    get { return _FieldText; }

     

     

    set { _FieldText = value; }

     

     }

     

    public string FieldURL

     

     {

     

    get { return _FieldURL; }

     

     

    set { _FieldURL = value; }

     

     }

     

    public string Value

     

     {

     

    get { return _Value; }

     

     

    set { _Value = value; }

     

     }

     

    #endregion

    #region

    Methods

     

     

    public static List<treeViewClass> BuildTree()

    {

     

    List<treeViewClass> treeList = new List<treeViewClass>();

     

     

    treeViewClass tree = new treeViewClass();

    tree.FiledId = 1;

    tree.ParentId =

    null;

     

     tree.FieldText =

    "E-Mail Sites";

     

     tree.FieldURL =

    "";

     

     tree.Value =

    "";

     

     treeList.Add(tree);

    tree =

    new treeViewClass();

     

     tree.FiledId = 4;

    tree.ParentId = 1;

    tree.FieldText =

    "Yahoo";

     

     tree.FieldURL =

    "http://www.yahoo.com";

     

     tree.Value =

    "Yahoo";

     

     treeList.Add(tree);

    tree =

    new treeViewClass();

     

     tree.FiledId = 4;

    tree.ParentId = 1;

    tree.FieldText =

    "Google";

     

     tree.FieldURL =

    "http://www.Gmail.com";

     

     tree.Value =

    "GMail";

     

     treeList.Add(tree);

     

    tree =

    new treeViewClass();

     

     tree.FiledId = 2;

    tree.ParentId =

    null;

     

     tree.FieldText =

    "Search Sites";

     

     tree.FieldURL =

    "";

     

     tree.Value =

    "";

     

     treeList.Add(tree);

    tree =

    new treeViewClass();

     

     tree.FiledId = 5;

    tree.ParentId = 2;

    tree.FieldText =

    "Google";

     

     tree.FieldURL =

    "http://www.Google.com";

     

     tree.Value =

    "GMail";

     

     treeList.Add(tree);

    tree =

    new treeViewClass();

     

     tree.FiledId = 6;

    tree.ParentId = 2;

    tree.FieldText =

    "Ask It";

     

     tree.FieldURL =

    "http://www.askit.com";

     

     tree.Value =

    "AskiIt";

     

     treeList.Add(tree);

    tree.FiledId = 3;

    tree.ParentId =

    null;

     

     tree.FieldText =

    "Funny Sites";

     

     tree.FieldURL =

    "";

     

     tree.Value =

    "";

     

     tree =

    new treeViewClass();

     

     tree.FiledId = 7;

    tree.ParentId = 3;

    tree.FieldText =

    "Mini Clip";

     

     tree.FieldURL =

    "http://www.MINICLIP.com";

     

     tree.Value =

    "MINI";

     

     treeList.Add(tree);

    tree =

    new treeViewClass();

     

     tree.FiledId = 8;

    tree.ParentId = 3;

    tree.FieldText =

    "Yalla Kora";

     

     tree.FieldURL =

    "http://www.YallaKora.com";

     

     tree.Value =

    "Kora";

     

     treeList.Add(tree);

     

     

    return treeList;

     

    }

     

    #endregion

     

    }

    when i use object data source Like The Following  

     

     

     

    <telerik:RadTreeView ID="RadTreeView1" Runat="server" DataFieldID="FiledId" 

     

    DataFieldParentID="ParentId" DataNavigateUrlField="FieldURL"

     

     

    DataSourceID="ObjectDataSource1" DataTextField="FieldText"

     

     

    DataValueField="Value" Skin="Web20">

     

     <

    CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>

     

     <

    ExpandAnimation Duration="100"></ExpandAnimation>

     

     

    </telerik:RadTreeView>
     

     

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"  

     

    SelectMethod="BuildTree" TypeName="treeViewClass"></asp:ObjectDataSource>

    the tree not appear in the write way Like This

    all appear like Parent Node

    Please Help me
    Or i will become acrazy MAN

     

     

     

     

  2. Lisbeth
    Lisbeth avatar
    1 posts
    Member since:
    Jul 2008

    Posted 01 Apr 2009 Link to this post

    I have the same problem,

    PLEASE ANSWER US.
  3. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 02 Apr 2009 Link to this post

    Hello guys,

    I have created a sample project using VS 2008 and the latest Q1 2009 version of RadControls and everything works as expected. Please find my test project attached.


    Kind regards,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top