Hi,
I am using rad tree view within asp.net page. In page i have set the MaintainScrollPositionOnPostback="true". But when i expand the tree, scroll position goes to expanded item. I want my page's scroll position to remain same. Let me know how can i fix this.
Thanks,
I am using rad tree view within asp.net page. In page i have set the MaintainScrollPositionOnPostback="true". But when i expand the tree, scroll position goes to expanded item. I want my page's scroll position to remain same. Let me know how can i fix this.
Thanks,
5 Answers, 1 is accepted
0
Hi Avinash,
Well, MaintainScrollPositionOnPostback is used in situations you actually want to persist position regarding last action. For example, you scroll down the tree and edit it's last item, but as it happens the handler of the NodeEdit event is on the server and the page postbacks. Without MaintainScrollPositionOnPostback set to true, the page will have the default scroll position.
A solution to your problem would be either:
1. to stop MaintainScrollPositionOnPostback;
2. if you need non-default scrollPosition, you can persist the position in cookie and on pageLoad (or even better on ClientLoad event of the TreeView) to restore it.
Hope this is helpful for you!
Regards,
Nikolay Tsenkov
the Telerik team
Well, MaintainScrollPositionOnPostback is used in situations you actually want to persist position regarding last action. For example, you scroll down the tree and edit it's last item, but as it happens the handler of the NodeEdit event is on the server and the page postbacks. Without MaintainScrollPositionOnPostback set to true, the page will have the default scroll position.
A solution to your problem would be either:
1. to stop MaintainScrollPositionOnPostback;
2. if you need non-default scrollPosition, you can persist the position in cookie and on pageLoad (or even better on ClientLoad event of the TreeView) to restore it.
Hope this is helpful for you!
Regards,
Nikolay Tsenkov
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

Ayush
Top achievements
Rank 1
answered on 02 Jan 2014, 06:05 AM
Hello,
Am using Rad Tree view and everything works fine but am facing problem in expand and collapse.
Whenever the page loads the treeview automatically collapse so the user is confused ?
Am using Rad Tree view and everything works fine but am facing problem in expand and collapse.
Whenever the page loads the treeview automatically collapse so the user is confused ?
0

Shinu
Top achievements
Rank 2
answered on 02 Jan 2014, 07:36 AM
Hi Ayush,
I guess that you are Expanding the RadTreeNode from server side. Please have a look into the sample code snippet which works fine at my end.
ASPX:
C#:
Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.
I guess that you are Expanding the RadTreeNode from server side. Please have a look into the sample code snippet which works fine at my end.
ASPX:
<
telerik:RadTreeView
ID
=
"RadTreeView1"
runat
=
"server"
>
<
Nodes
>
<
telerik:RadTreeNode
Text
=
"Node1"
runat
=
"server"
>
<
Nodes
>
<
telerik:RadTreeNode
Text
=
"Node1.1"
runat
=
"server"
>
</
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"Node1.2"
runat
=
"server"
>
</
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"Node1.3"
runat
=
"server"
>
</
telerik:RadTreeNode
>
</
Nodes
>
</
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"Node2"
runat
=
"server"
>
<
Nodes
>
<
telerik:RadTreeNode
Text
=
"Node2.1"
runat
=
"server"
>
</
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"Node2.2"
runat
=
"server"
>
</
telerik:RadTreeNode
>
<
telerik:RadTreeNode
Text
=
"Node2.3"
runat
=
"server"
>
</
telerik:RadTreeNode
>
</
Nodes
>
</
telerik:RadTreeNode
>
</
Nodes
>
</
telerik:RadTreeView
>
C#:
protected
void
Page_Load(
object
sender, EventArgs e)
{
RadTreeNode node = RadTreeView1.FindNodeByText(
"Node1"
);
node.Expanded =
true
;
}
Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.
0

Ayush
Top achievements
Rank 1
answered on 02 Jan 2014, 09:08 AM
Hello Shinu,
In my case the data is coming from database I have not created any node in designer page.
Thanks,
In my case the data is coming from database I have not created any node in designer page.
Thanks,
0

Shinu
Top achievements
Rank 2
answered on 03 Jan 2014, 03:05 AM
Hi Ayush,
Please have a look into the following code snippet which works as expected for me.
C#:
Let me know if you have any concern.
Thanks,
Shinu.
Please have a look into the following code snippet which works as expected for me.
C#:
protected
void
Page_Load(
object
sender, EventArgs e)
{
SqlDataAdapter adapter =
new
SqlDataAdapter(
"SELECT * FROM Details"
, ConfigurationManager.ConnectionStrings[
"NorthwindConnectionString"
].ConnectionString);
DataTable data =
new
DataTable();
adapter.Fill(data);
RadTreeView1.DataSource = data;
RadTreeView1.DataTextField =
"text"
;
RadTreeView1.DataFieldParentID =
"parentid"
;
RadTreeView1.DataFieldID =
"id"
;
RadTreeView1.DataBind();
RadTreeNode node = RadTreeView1.FindNodeByText(
"Politics"
);
node.Expanded =
true
;
}
Let me know if you have any concern.
Thanks,
Shinu.