Please see my response to your last post "Events Handling Order"
--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
"Netvision Mail" <> wrote in message
news:bq063q$ijc$...
> Hi all,
> I'm a total newbie, so this might be stupid...
> Anyway, I've created an expanding tree of categories control, based on
> DataList.
> It works almost fine, but I can't make it return the value of the last
> category clicked.
> To be more specific, it does return it, but only the second time I click
the
> category.
> For example, if I click category 5 and then 8, it shows 5 and clicking
later
> on 3 shows 8.
>
> It goes like this:
>
> .
> .
> .
> public property CategoryID
> Get
> if(ViewState("CurrentCategory") = Nothing)
> CategoryID = 1
> else
> CategoryID = ViewState("CurrentCategory").ToString
> end if
> End Get
> Set
>
> ViewState("CurrentCategory") = value
> End Set
> end property
>
> .
> .
> .
>
> sub CategoriesDataList_ItemCommand(sender As Object, e as
> DataListCommandEventArgs)
> CategoryID = e.CommandArgument
> CategoriesDataList.DataSource = GetCategoriesTree(e.CommandArgument)
> DataBind
> CategoriesDataList.SelectedIndex = e.Item.ItemIndex
> End Sub
>
> The real big problem, as much as I could figure it out is that the
> CategoriesDataList_ItemCommand event is processed AFTER the Page_Load
event
> of the parent page is. So, when i write something like
>
> [assume CategoriesTree is a CategoriesDataList control]
>
> msg.Text = CategoriesTree.CategoryID
>
> in the parent page, the value shown in msg is the old one (taken from
> ViewState bag).
>
>
> Thanks for any help,
> Igor.
>
>
>
>