Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > User Control properties

Reply
Thread Tools

User Control properties

 
 
Netvision Mail
Guest
Posts: n/a
 
      11-25-2003
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.




 
Reply With Quote
 
 
 
 
Victor Garcia Aprea
Guest
Posts: n/a
 
      11-26-2003
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.
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Designer Support: How to have user control's properties appear in IDE's properties window? Max2006 ASP .Net 2 07-13-2007 01:45 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Making Custom Control Properties Visible in Visual Studio's Properties Palette Nathan Sokalski ASP .Net 0 10-17-2005 02:05 AM
Reference a user controls properties from another user control?? =?Utf-8?B?YWJqb3Jr?= ASP .Net 1 05-05-2004 02:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57