Search:
Namespaces
Discussions
.NET v1.1
Feedback
problem in mobile:SelectionList
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngmob' list
.
Mayur Bapat
Hi,
I am facing the following problem :
In the <mobile:selectionList> control though
I have specified the items as -
<mobile:SelectionList runat="server" >
<item text="abc" value="abc"/>
<item text="efg" value="efg"/>
</mobile:SelectionList>
When I try to access it in code behind page
the selected item's Value gives me '0' for
item abc, '1' for item efg ..and so on ...
Is there any way by which I can access the values
I have supplied in the code.
Thanks & regards,
Mayur
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
Reply to this message...
Anil John
Mayur,
Please post the relevant code that you are using to access the list value.. Looks like you are getting the index and not the value.
Anil
---------- Original Message ----------------------------------
From: Mayur Bapat <
Click here to reveal e-mail address
>
Reply-To: "aspngmob" <
Click here to reveal e-mail address
>
Date: Thu, 13 Jun 2002 23:29:52 -0700 (PDT)
Hi,
I am facing the following problem :
In the <mobile:selectionList> control though
I have specified the items as -
<mobile:SelectionList runat="server" >
<item text="abc" value="abc"/>
<item text="efg" value="efg"/>
</mobile:SelectionList>
When I try to access it in code behind page
the selected item's Value gives me '0' for
item abc, '1' for item efg ..and so on ...
Is there any way by which I can access the values
I have supplied in the code.
Thanks & regards,
Mayur
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
| [aspngmob] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngmob.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
--
-- Anil John -
http://LearnMobile.net
-- #1 .net Mobile & Wireless Resource
-- Connect with .net - Anytime. Anywhere.
--
Reply to this message...
Mayur Bapat
Hi,
Sorry for the delay in sending the code ...
The code is as follows :
// add the list items from the enumerator
while(keys.MoveNext() && values.MoveNext())
{
selaccessories.Items.Add(new
MobileListItem
((String)keys.Current,(String)values.Current));
}
for retrieving, using the following code --
String strValue =
selaccessories.Items[selaccessories.SelectedIndex].Value;
String strText =
selaccessories.Items[selaccessories.SelectedIndex].Text;
so here in strValue it gives me the index as you said
and not the value passed in the while loop ...
Thanx,
Mayur
--- Anil John <
Click here to reveal e-mail address
> wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
Reply to this message...
Shanku Niyogi
Mayur,
I tried a similar chunk of code (see below), and it seems to work as
expected.
Have you verified that the enumerator you are originally using is
returning the correct values, rather than just indices? One way you can
check this is to also bind the text to the value, i.e. change the
constructor to=20
new
MobileListItem
((String)values.Current, (String)values.Current)
and see what you get.
Thanks,
Shanku
Here's the code I tried. When you run this, the label gets set to "Value
0".
<script runat=3D"server">
void Page_Load(Object sender,
EventArgs
e) {
for (int i =3D 0; i < 5; i++) {
theSel.Items.Add(new
MobileListItem
("Item " + i, "Value " + i));
}
theLabel.Text =3D theSel.Items[0].Value;
}
</script>
<mobile:Form runat=3D"server">
<mobile:Label runat=3D"server" id=3D"theLabel" />
<mobile:SelectionList runat=3D"server" id=3D"theSel" />
</mobile:Form>
=20
=20
=20
=20
=20
--
This posting is provided "AS IS" with no warranties, and confers no
rights.
-----Original Message-----
From: Mayur Bapat [mailto:
Click here to reveal e-mail address
]=20
Sent: Monday, June 17, 2002 5:54 AM
To: aspngmob
Subject: [aspngmob] Re: problem in mobile:SelectionList
Hi,
Sorry for the delay in sending the code ...
The code is as follows :
// add the list items from the enumerator
while(keys.MoveNext() && values.MoveNext())
{
selaccessories.Items.Add(new
MobileListItem
((String)keys.Current,(String)values.Current));
}
for retrieving, using the following code --
String strValue =3D
selaccessories.Items[selaccessories.SelectedIndex].Value;
String strText =3D
selaccessories.Items[selaccessories.SelectedIndex].Text;
so here in strValue it gives me the index as you said
and not the value passed in the while loop ...
Thanx,
Mayur
--- Anil John <
Click here to reveal e-mail address
> wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
| [aspngmob] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngmob.asp
=3D JOIN/QUIT=20
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
Mayur Bapat
Hi Shanku,
I tried adding
MobileListItem
with hardcoded values
instead of using the values from enumerator as
follows :
theSel.Items.Add(new
MobileListItem
("Item1","Value1");
theSel.Items.Add(new
MobileListItem
("Item2","Value2");
The HTML output is -
<select name="theSel">
<option value="0">Item1
<option value="1">Item2
</select>
and the WML output is -
<select iname="theSel">
<option>Item1</option>
<option>Item2</option>
</select>
So What may be the problem ?
Is it because I am using .NET Framework v1.0.2914
and MMIT v1.0.1722 ?
Thanks and Regards,
Mayur
--- Shanku Niyogi <
Click here to reveal e-mail address
> wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
Reply to this message...
Simon Calvert
Did you check theSel.Selection.Value on postback after selecting a list
item, or are you concerned about the value attribute in the markup?
Simon.
This posting is provided "AS IS" with no warranties,
and confers no rights.
-----Original Message-----
From: Mayur Bapat [mailto:
Click here to reveal e-mail address
]=20
Sent: Tuesday, June 18, 2002 10:02 PM
To: aspngmob
Subject: [aspngmob] Re: problem in mobile:SelectionList
Hi Shanku,
I tried adding
MobileListItem
with hardcoded values
instead of using the values from enumerator as
follows :
theSel.Items.Add(new
MobileListItem
("Item1","Value1");
theSel.Items.Add(new
MobileListItem
("Item2","Value2");
The HTML output is -
<select name=3D"theSel">
<option value=3D"0">Item1
<option value=3D"1">Item2
</select>
and the WML output is -
<select iname=3D"theSel">
<option>Item1</option>
<option>Item2</option>
</select>
So What may be the problem ?
Is it because I am using .NET Framework v1.0.2914
and MMIT v1.0.1722 ?
Thanks and Regards,
Mayur
--- Shanku Niyogi <
Click here to reveal e-mail address
> wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
| [aspngmob] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngmob.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
Shanku Niyogi
The value attribute output on the client will always be the index of the
item. But when you postback, if you get the
MobileListItem
, it's Value
property will be the value you set.
E.g. on client side, sel.options[0].value =3D "0"
But on server side, sel.Items[0].Value =3D "Value1"
Shanku
-----Original Message-----
From: Mayur Bapat [mailto:
Click here to reveal e-mail address
]=20
Sent: Tuesday, June 18, 2002 10:02 PM
To: aspngmob
Subject: [aspngmob] Re: problem in mobile:SelectionList
Hi Shanku,
I tried adding
MobileListItem
with hardcoded values
instead of using the values from enumerator as
follows :
theSel.Items.Add(new
MobileListItem
("Item1","Value1");
theSel.Items.Add(new
MobileListItem
("Item2","Value2");
The HTML output is -
<select name=3D"theSel">
<option value=3D"0">Item1
<option value=3D"1">Item2
</select>
and the WML output is -
<select iname=3D"theSel">
<option>Item1</option>
<option>Item2</option>
</select>
So What may be the problem ?
Is it because I am using .NET Framework v1.0.2914
and MMIT v1.0.1722 ?
Thanks and Regards,
Mayur
--- Shanku Niyogi <
Click here to reveal e-mail address
> wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
| [aspngmob] member
Click here to reveal e-mail address
=3D YOUR ID=20
|
http://www.asplists.com/asplists/aspngmob.asp
=3D JOIN/QUIT=20
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
Mayur Bapat
after postback, on the server side I am getting
the same old result and not the actual value but the
indices ...
Mayur
--- Shanku Niyogi <
Click here to reveal e-mail address
> wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
Reply to this message...
Anil John
Mayur,
I assume that you are using the RTM versin of the Framework and the MMIT?
Please post both the COMPLETE aspx page and the codebehind. It might help if we can replicate your problem completely.
Anil
---------- Original Message ----------------------------------
From: Mayur Bapat <
Click here to reveal e-mail address
>
Reply-To: "aspngmob" <
Click here to reveal e-mail address
>
Date: Wed, 19 Jun 2002 21:55:15 -0700 (PDT)
after postback, on the server side I am getting
the same old result and not the actual value but the
indices ...
Mayur
--- Shanku Niyogi <
Click here to reveal e-mail address
> wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
| [aspngmob] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngmob.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
--
-- Anil John -
http://LearnMobile.net
-- #1 .net Mobile & Wireless Resource
-- Connect with .net - Anytime. Anywhere.
--
Reply to this message...
System.EventArgs
System.Web.UI.MobileControls.MobileListItem
System.Web.UI.MobileControls.SelectionList
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com