Home All Groups Group Topic Archive Search About

ASP.NET 2.0 Treeview No Postback?

Author
7 Sep 2006 3:00 PM
Matt MacDonald
Hi All,
  I have a form that displays hierarchical categories in a treeview.  Ok so
far so good.  What I was to do is have users be able to select a node in the
treeview as part of filling out the form.  I only want to allow single
selection, so using checkboxes is out of the question.  It works as is, but
it makes the form very cumbersome if every time that a user selects a node,
the whole page has to reload.  Is there a way to have a node become selected
without using postback?  I tried setting the navigateurl of all the nodes to
"javascript:void(0);" as was suggested in one post.  This works, however, if
a node is currently selected in the tree via server side code, this doesn't
de-select that node.  This also doesn't work very well in non-IE browsers.
I also started to experiment using ICallbackEventHandler to use server side
functions without reposting, but that doesn't seem to work in this scenario
(I don't think).  Does anyone have any way of getting around this?  I really
wish the autopostback property had been built into the treeview like in
other serverside data controls.

Thanks in advance for any help,
  Matt

Author
7 Sep 2006 5:21 PM
Teemu Keiski
Simple way is just to use Atlas. E,g put the TreeView in a UpdatePanel.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke




Show quote
"Matt MacDonald" <matts***@hotmail.com> wrote in message
news:%236Tyk5o0GHA.4920@TK2MSFTNGP06.phx.gbl...
> Hi All,
>  I have a form that displays hierarchical categories in a treeview.  Ok so
> far so good.  What I was to do is have users be able to select a node in
> the treeview as part of filling out the form.  I only want to allow single
> selection, so using checkboxes is out of the question.  It works as is,
> but it makes the form very cumbersome if every time that a user selects a
> node, the whole page has to reload.  Is there a way to have a node become
> selected without using postback?  I tried setting the navigateurl of all
> the nodes to "javascript:void(0);" as was suggested in one post.  This
> works, however, if a node is currently selected in the tree via server
> side code, this doesn't de-select that node.  This also doesn't work very
> well in non-IE browsers. I also started to experiment using
> ICallbackEventHandler to use server side functions without reposting, but
> that doesn't seem to work in this scenario (I don't think).  Does anyone
> have any way of getting around this?  I really wish the autopostback
> property had been built into the treeview like in other serverside data
> controls.
>
> Thanks in advance for any help,
>  Matt
>
Author
8 Sep 2006 3:48 PM
Matt MacDonald
Can you please explain further?  I'm not familiar with Atlas.

Thanks,
  Matt

Show quote
"Teemu Keiski" <jot***@aspalliance.com> wrote in message
news:OhBdFIq0GHA.4924@TK2MSFTNGP05.phx.gbl...
> Simple way is just to use Atlas. E,g put the TreeView in a UpdatePanel.
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
>
>
>
>
> "Matt MacDonald" <matts***@hotmail.com> wrote in message
> news:%236Tyk5o0GHA.4920@TK2MSFTNGP06.phx.gbl...
>> Hi All,
>>  I have a form that displays hierarchical categories in a treeview.  Ok
>> so far so good.  What I was to do is have users be able to select a node
>> in the treeview as part of filling out the form.  I only want to allow
>> single selection, so using checkboxes is out of the question.  It works
>> as is, but it makes the form very cumbersome if every time that a user
>> selects a node, the whole page has to reload.  Is there a way to have a
>> node become selected without using postback?  I tried setting the
>> navigateurl of all the nodes to "javascript:void(0);" as was suggested in
>> one post.  This works, however, if a node is currently selected in the
>> tree via server side code, this doesn't de-select that node.  This also
>> doesn't work very well in non-IE browsers. I also started to experiment
>> using ICallbackEventHandler to use server side functions without
>> reposting, but that doesn't seem to work in this scenario (I don't
>> think).  Does anyone have any way of getting around this?  I really wish
>> the autopostback property had been built into the treeview like in other
>> serverside data controls.
>>
>> Thanks in advance for any help,
>>  Matt
>>
>
>
Author
9 Sep 2006 8:23 AM
Teemu Keiski
It is Microsoft's implementation of AJAX: See http://atlas.asp.net

With it you can make page work without visible postbacks while still keeping
the server-side functionality.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


Show quote
"Matt MacDonald" <matts***@hotmail.com> wrote in message
news:%23ywPy410GHA.2196@TK2MSFTNGP03.phx.gbl...
> Can you please explain further?  I'm not familiar with Atlas.
>
> Thanks,
>  Matt
>
> "Teemu Keiski" <jot***@aspalliance.com> wrote in message
> news:OhBdFIq0GHA.4924@TK2MSFTNGP05.phx.gbl...
>> Simple way is just to use Atlas. E,g put the TreeView in a UpdatePanel.
>>
>> --
>> Teemu Keiski
>> ASP.NET MVP, AspInsider
>> Finland, EU
>> http://blogs.aspadvice.com/joteke
>>
>>
>>
>>
>> "Matt MacDonald" <matts***@hotmail.com> wrote in message
>> news:%236Tyk5o0GHA.4920@TK2MSFTNGP06.phx.gbl...
>>> Hi All,
>>>  I have a form that displays hierarchical categories in a treeview.  Ok
>>> so far so good.  What I was to do is have users be able to select a node
>>> in the treeview as part of filling out the form.  I only want to allow
>>> single selection, so using checkboxes is out of the question.  It works
>>> as is, but it makes the form very cumbersome if every time that a user
>>> selects a node, the whole page has to reload.  Is there a way to have a
>>> node become selected without using postback?  I tried setting the
>>> navigateurl of all the nodes to "javascript:void(0);" as was suggested
>>> in one post.  This works, however, if a node is currently selected in
>>> the tree via server side code, this doesn't de-select that node.  This
>>> also doesn't work very well in non-IE browsers. I also started to
>>> experiment using ICallbackEventHandler to use server side functions
>>> without reposting, but that doesn't seem to work in this scenario (I
>>> don't think).  Does anyone have any way of getting around this?  I
>>> really wish the autopostback property had been built into the treeview
>>> like in other serverside data controls.
>>>
>>> Thanks in advance for any help,
>>>  Matt
>>>
>>
>>
>
>

AddThis Social Bookmark Button