[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

ZimLock999

12/17/2002 12:36:00 AM

On my standard ASP.NET pages I am able to bind an ADO resultset and then add
a default item with the following line of code:
dropClass.Items.Insert( 0, New ListItem( "--none selected--", -1 ) )

The page is rendered with "--none selected--" at the top of the DropDownList
and defaults to this item.

Now I am trying to do the same using mobile web controls (SelectList). I was
able to add the item with the following code:
dropClass.Items.Add( new MobileListItem("--none selected--", "-1" ) )

The value is ignored though. After trying a number of things and reading the
other posts on this newsgroup, I have been able to determine that the value
property of the items are being ignored altogether. The index is being
assigned to the value, starting with 0.

I was using:
dropClass.DataValueField = "intClassID"
dropClass.DataTextField = "chrDescription"
to fill the SelectList.

The DataValueField property and Items.Add( ..., "value") are worthless.

This doesn't work at all since I will need the intClassID value when an item
is selected, not the chrDescription.

Has anyone found a workaround solution to this problems?

Thanks!


2 Answers

ZimLock999

12/17/2002 1:10:00 AM

0

O.K. The value property is being set correctly. I can return it's value.
This process must happen on the server side.

I need to get the newly added item to the top of my SelectList. I have
attempted to add it before binding, but that overwrites it.


"ZimLock999" <zimlock999@hotmail.com> wrote in message
news:#UG4xvVpCHA.2764@TK2MSFTNGP09...
> On my standard ASP.NET pages I am able to bind an ADO resultset and then
add
> a default item with the following line of code:
> dropClass.Items.Insert( 0, New ListItem( "--none selected--", -1 ) )
>
> The page is rendered with "--none selected--" at the top of the
DropDownList
> and defaults to this item.
>
> Now I am trying to do the same using mobile web controls (SelectList). I
was
> able to add the item with the following code:
> dropClass.Items.Add( new MobileListItem("--none selected--", "-1" ) )
>
> The value is ignored though. After trying a number of things and reading
the
> other posts on this newsgroup, I have been able to determine that the
value
> property of the items are being ignored altogether. The index is being
> assigned to the value, starting with 0.
>
> I was using:
> dropClass.DataValueField = "intClassID"
> dropClass.DataTextField = "chrDescription"
> to fill the SelectList.
>
> The DataValueField property and Items.Add( ..., "value") are worthless.
>
> This doesn't work at all since I will need the intClassID value when an
item
> is selected, not the chrDescription.
>
> Has anyone found a workaround solution to this problems?
>
> Thanks!
>
>


ZimLock999

12/17/2002 1:37:00 AM

0

I got it! I got it! I got it!

dropClass.Items.Insert( 0 , new MobileListItem("--none selected--", "-1" ) )

Now I'm hitting myself over the head. What a moron I've been!

"ZimLock999" <zimlock999@hotmail.com> wrote in message
news:esl13CWpCHA.1664@TK2MSFTNGP10...
> O.K. The value property is being set correctly. I can return it's value.
> This process must happen on the server side.
>
> I need to get the newly added item to the top of my SelectList. I have
> attempted to add it before binding, but that overwrites it.
>
>
> "ZimLock999" <zimlock999@hotmail.com> wrote in message
> news:#UG4xvVpCHA.2764@TK2MSFTNGP09...
> > On my standard ASP.NET pages I am able to bind an ADO resultset and then
> add
> > a default item with the following line of code:
> > dropClass.Items.Insert( 0, New ListItem( "--none selected--", -1 ) )
> >
> > The page is rendered with "--none selected--" at the top of the
> DropDownList
> > and defaults to this item.
> >
> > Now I am trying to do the same using mobile web controls (SelectList). I
> was
> > able to add the item with the following code:
> > dropClass.Items.Add( new MobileListItem("--none selected--",
"-1" ) )
> >
> > The value is ignored though. After trying a number of things and reading
> the
> > other posts on this newsgroup, I have been able to determine that the
> value
> > property of the items are being ignored altogether. The index is being
> > assigned to the value, starting with 0.
> >
> > I was using:
> > dropClass.DataValueField = "intClassID"
> > dropClass.DataTextField = "chrDescription"
> > to fill the SelectList.
> >
> > The DataValueField property and Items.Add( ..., "value") are worthless.
> >
> > This doesn't work at all since I will need the intClassID value when an
> item
> > is selected, not the chrDescription.
> >
> > Has anyone found a workaround solution to this problems?
> >
> > Thanks!
> >
> >
>
>