Event get back the Inherits class

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

I have a problem of accessing the custom class that I inherits from
mobilelistitem. I create the following code for new class of mobilelistitem1
and putting value on this class for the List.
Class MobileListItem1
Inherits System.Web.UI.MobileControls.MobileListItem
Public Value2 As String
Public Value3 As String
End Class

And when I click the List, I generate an item_command event and have trigger
value of 'e'. In normal I can use e.ListItem.value to access the normal
class value, but if I use the custom class, how can I access the value2 and
value3 value during the system generated event?

Simon
 
K

Ken Tucker [MVP]

Hi,

(Untested)
dim mi as MobileListItem1 = ctype(e.ListItem.value,MobileListItem1)

Ken
------------
I have a problem of accessing the custom class that I inherits from
mobilelistitem. I create the following code for new class of mobilelistitem1
and putting value on this class for the List.
Class MobileListItem1
Inherits System.Web.UI.MobileControls.MobileListItem
Public Value2 As String
Public Value3 As String
End Class

And when I click the List, I generate an item_command event and have trigger
value of 'e'. In normal I can use e.ListItem.value to access the normal
class value, but if I use the custom class, how can I access the value2 and
value3 value during the system generated event?

Simon
 
C

Cor Ligthert

Hi,

Not that you are not welcome here, however did you know that there is a
newsgroup.

Microsoft.public.dotnet.framework.compactframework

e is an reference to your eventargument object and not to your listview
itself. Therefore you have to inherit the listview for you are using with
your new listviewitem.

Probably is it much easier to add an instanced class as object to the tag
from your listviewitems.

I hope this helps?

Cor
 
P

PLS

Sorry that I still have error, I change to this syntax "Dim MobileListItems
As MobileListItem1 = CType(e.ListItem, MobileListItem1)" and it give me
"System.InvalidCastException: Specified cast is not valid" Error.

Simon
 
K

Ken Tucker [MVP]

Hi,

Try e.ListItem.value instead of e.ListItem

Ken
--------------
Sorry that I still have error, I change to this syntax "Dim MobileListItems
As MobileListItem1 = CType(e.ListItem, MobileListItem1)" and it give me
"System.InvalidCastException: Specified cast is not valid" Error.

Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top