By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,899 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,899 IT Pros & Developers. It's quick & easy.

TreeView and Master Pages

P: n/a
I need to know how to maintain de status (nodes expanded and selected) of a
treeview in a master page.

I have a master page with a treeview. I have a default page, when the
treeview is expanded and a node is selected then redirects to a another page

Response.Redirect("Page2.aspx")

And run's ok, but the treeview in this page is colapsed. The treeview
maintain its aspect, the images for the nodes, etc, but is colapsed and
nothing node is selected

Many thanks for your help
Dec 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Juanjo,

Store the selected node number in viewstate and on page loads check that
viewstate parameter and if a selected node exists set the treeview to
display it as selected.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Juanjo" <Ju****@discussions.microsoft.com> wrote in message
news:E5**********************************@microsof t.com...
I need to know how to maintain de status (nodes expanded and selected) of a
treeview in a master page.

I have a master page with a treeview. I have a default page, when the
treeview is expanded and a node is selected then redirects to a another
page

Response.Redirect("Page2.aspx")

And run's ok, but the treeview in this page is colapsed. The treeview
maintain its aspect, the images for the nodes, etc, but is colapsed and
nothing node is selected

Many thanks for your help

Dec 13 '05 #2

P: n/a
OK Justin,

I do it.

In the master page code

Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles TreeView1.SelectedNodeChanged

ViewState("SelectedNode") = TreeView1.SelectedNode.Value
Response.Redirect("Page2.aspx")

End Sub

And in the Page2_Load

If Me.ViewState("SelectedNode").ToString = "Perfiles" Then

'Code for selected node

End If

But now the problem is that ViewState("SelectedNode") is nothing. Not exists

What I'm doing wrong?
"S. Justin Gengo" wrote:
Juanjo,

Store the selected node number in viewstate and on page loads check that
viewstate parameter and if a selected node exists set the treeview to
display it as selected.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Juanjo" <Ju****@discussions.microsoft.com> wrote in message
news:E5**********************************@microsof t.com...
I need to know how to maintain de status (nodes expanded and selected) of a
treeview in a master page.

I have a master page with a treeview. I have a default page, when the
treeview is expanded and a node is selected then redirects to a another
page

Response.Redirect("Page2.aspx")

And run's ok, but the treeview in this page is colapsed. The treeview
maintain its aspect, the images for the nodes, etc, but is colapsed and
nothing node is selected

Many thanks for your help


Dec 13 '05 #3

P: n/a
Juanjo,

A response.redirect clears the viewstate. Either store the parameter in a
session variable (if that will be allright for your application) or use
Server.Transfer and store the value in a context variable instead. If you
need any clarification on how session variables or server.transfer and the
context object works let me know.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Juanjo" <Ju****@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
OK Justin,

I do it.

In the master page code

Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal
e
As System.EventArgs) Handles TreeView1.SelectedNodeChanged

ViewState("SelectedNode") =
TreeView1.SelectedNode.Value
Response.Redirect("Page2.aspx")

End Sub

And in the Page2_Load

If Me.ViewState("SelectedNode").ToString = "Perfiles" Then

'Code for selected node

End If

But now the problem is that ViewState("SelectedNode") is nothing. Not
exists

What I'm doing wrong?
"S. Justin Gengo" wrote:
Juanjo,

Store the selected node number in viewstate and on page loads check that
viewstate parameter and if a selected node exists set the treeview to
display it as selected.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Juanjo" <Ju****@discussions.microsoft.com> wrote in message
news:E5**********************************@microsof t.com...
>I need to know how to maintain de status (nodes expanded and selected)
>of a
> treeview in a master page.
>
> I have a master page with a treeview. I have a default page, when the
> treeview is expanded and a node is selected then redirects to a another
> page
>
> Response.Redirect("Page2.aspx")
>
> And run's ok, but the treeview in this page is colapsed. The treeview
> maintain its aspect, the images for the nodes, etc, but is colapsed and
> nothing node is selected
>
> Many thanks for your help


Dec 13 '05 #4

P: n/a
OK, thanx

Exists another way to load the page2.aspx without response.redirect command?

I'm a newbie in asp.net

"S. Justin Gengo" wrote:
Juanjo,

A response.redirect clears the viewstate. Either store the parameter in a
session variable (if that will be allright for your application) or use
Server.Transfer and store the value in a context variable instead. If you
need any clarification on how session variables or server.transfer and the
context object works let me know.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Juanjo" <Ju****@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
OK Justin,

I do it.

In the master page code

Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal
e
As System.EventArgs) Handles TreeView1.SelectedNodeChanged

ViewState("SelectedNode") =
TreeView1.SelectedNode.Value
Response.Redirect("Page2.aspx")

End Sub

And in the Page2_Load

If Me.ViewState("SelectedNode").ToString = "Perfiles" Then

'Code for selected node

End If

But now the problem is that ViewState("SelectedNode") is nothing. Not
exists

What I'm doing wrong?
"S. Justin Gengo" wrote:
Juanjo,

Store the selected node number in viewstate and on page loads check that
viewstate parameter and if a selected node exists set the treeview to
display it as selected.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Juanjo" <Ju****@discussions.microsoft.com> wrote in message
news:E5**********************************@microsof t.com...
>I need to know how to maintain de status (nodes expanded and selected)
>of a
> treeview in a master page.
>
> I have a master page with a treeview. I have a default page, when the
> treeview is expanded and a node is selected then redirects to a another
> page
>
> Response.Redirect("Page2.aspx")
>
> And run's ok, but the treeview in this page is colapsed. The treeview
> maintain its aspect, the images for the nodes, etc, but is colapsed and
> nothing node is selected
>
> Many thanks for your help


Dec 13 '05 #5

P: n/a
Juanjo,

Yes, the other way is to use Server.Transfer.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Juanjo" <Ju****@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
OK, thanx

Exists another way to load the page2.aspx without response.redirect
command?

I'm a newbie in asp.net

"S. Justin Gengo" wrote:
Juanjo,

A response.redirect clears the viewstate. Either store the parameter in a
session variable (if that will be allright for your application) or use
Server.Transfer and store the value in a context variable instead. If you
need any clarification on how session variables or server.transfer and
the
context object works let me know.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Juanjo" <Ju****@discussions.microsoft.com> wrote in message
news:DE**********************************@microsof t.com...
> OK Justin,
>
> I do it.
>
> In the master page code
>
> Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object,
> ByVal
> e
> As System.EventArgs) Handles TreeView1.SelectedNodeChanged
>
> ViewState("SelectedNode") =
> TreeView1.SelectedNode.Value
> Response.Redirect("Page2.aspx")
>
> End Sub
>
>
>
> And in the Page2_Load
>
> If Me.ViewState("SelectedNode").ToString = "Perfiles" Then
>
> 'Code for selected node
>
> End If
>
> But now the problem is that ViewState("SelectedNode") is nothing. Not
> exists
>
> What I'm doing wrong?
> "S. Justin Gengo" wrote:
>
>> Juanjo,
>>
>> Store the selected node number in viewstate and on page loads check
>> that
>> viewstate parameter and if a selected node exists set the treeview to
>> display it as selected.
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "Juanjo" <Ju****@discussions.microsoft.com> wrote in message
>> news:E5**********************************@microsof t.com...
>> >I need to know how to maintain de status (nodes expanded and
>> >selected)
>> >of a
>> > treeview in a master page.
>> >
>> > I have a master page with a treeview. I have a default page, when
>> > the
>> > treeview is expanded and a node is selected then redirects to a
>> > another
>> > page
>> >
>> > Response.Redirect("Page2.aspx")
>> >
>> > And run's ok, but the treeview in this page is colapsed. The
>> > treeview
>> > maintain its aspect, the images for the nodes, etc, but is colapsed
>> > and
>> > nothing node is selected
>> >
>> > Many thanks for your help
>>
>>
>>


Dec 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.