[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

BUG? Adding items to a SelectionList object

Erik

12/5/2002 5:02:00 AM

I'm having a major problem adding a MobileListItem to a SelectionList
object. I need to do this in the code behind, not in the MMIT designer. No
matter how I try the value of the options alway starts at 0 and increments
up, even when I try to explicitly set as in the below code. Is this a bug?

--CODE
SelectionList sel = new SelectionList();
sel.ID = "cmbReps1";
MobileListItem _ml = new MobileListItem("text", "value");
sel.Items.Add(_ml);


--RESULTS
<select name="cmbReps1">
<option value="0">text
</select>


The option should render as <option value="value">text.


2 Answers

Pierluigi

12/5/2002 8:23:00 PM

0

Try to use a static selectionlist (declared at design time) and then add
items at runtime.

"Erik" <eolson@ArtsAndCraftsFair.com> ha scritto nel messaggio
news:#QJ1WMBnCHA.1612@TK2MSFTNGP09...
> I'm having a major problem adding a MobileListItem to a SelectionList
> object. I need to do this in the code behind, not in the MMIT designer.
No
> matter how I try the value of the options alway starts at 0 and increments
> up, even when I try to explicitly set as in the below code. Is this a
bug?
>
> --CODE
> SelectionList sel = new SelectionList();
> sel.ID = "cmbReps1";
> MobileListItem _ml = new MobileListItem("text", "value");
> sel.Items.Add(_ml);
>
>
> --RESULTS
> <select name="cmbReps1">
> <option value="0">text
> </select>
>
>
> The option should render as <option value="value">text.
>
>


Erik

12/6/2002 6:57:00 AM

0

Unfortunately, I'm adding the SelectionList dynamically too based on a
previous selection. I don't know if I'm adding 1 or 10 lists until runtime.
If I can't do this, it must be a bug. Items.Add() should always work.



"Pierluigi" <pierluigi@box.it> wrote in message
news:u34gqNJnCHA.392@TK2MSFTNGP09...
> Try to use a static selectionlist (declared at design time) and then add
> items at runtime.
>
> "Erik" <eolson@ArtsAndCraftsFair.com> ha scritto nel messaggio
> news:#QJ1WMBnCHA.1612@TK2MSFTNGP09...
> > I'm having a major problem adding a MobileListItem to a SelectionList
> > object. I need to do this in the code behind, not in the MMIT designer.
> No
> > matter how I try the value of the options alway starts at 0 and
increments
> > up, even when I try to explicitly set as in the below code. Is this a
> bug?
> >
> > --CODE
> > SelectionList sel = new SelectionList();
> > sel.ID = "cmbReps1";
> > MobileListItem _ml = new MobileListItem("text", "value");
> > sel.Items.Add(_ml);
> >
> >
> > --RESULTS
> > <select name="cmbReps1">
> > <option value="0">text
> > </select>
> >
> >
> > The option should render as <option value="value">text.
> >
> >
>
>