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 |


User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; InfoPath.2)
Timestamp: Tue, 31 Mar 2009 15:46:14 UTC
Message: Object doesn't support this property or method
Line: 43
Char: 1
Code: 0
Message: Sys.ArgumentException: does not derive from Sys.Component.
Parameter name: type
Line: 2707
Char: 9
Code: 0
protected void btnModify_Click(object sender, ImageClickEventArgs e)
{
RadGrid2.DataSource = GetDataTable(
"SELECT Users.Personelid, Users.name, Users.surname FROM Users WHERE");
RadGrid2.DataBind();
}
I do the above operation but Radgrid do not accept new datasource and change its columns acording to it. How can I assign a new datasource and bind it?All help will be appreciated. By the way I dont want to use need_datasource event, at first time gridview has to show nothing but after user make some operation and click the button it has to populate on demand and show the result of query