[lnkForumImage]
TotalShareware - Download Free Software

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


 

Geert Maesele

6/19/2002 1:14:00 PM

Hi all

I'm having two problems when using of an objectlist.
1. On the OpenWave 4.1 emulator my code goes in error when I add a
command to my objectlist. It says that there is no element selected, when I
want to see the details of an item in the objectlist.
2. On other browsers I cann't retrieve the selected element. When I
request the selectedIndex property of the object list I get -1.

Any ideas?
Here is my code.

<mobile:Form id="searchResults" runat="server" Paginate="True"
PagerStyle-NextPageText="Next page" PagerStyle-PreviousPageText="Previous
page">
<mobile:ObjectList id="carList" runat="server" ItemsPerPage="5"
Alignment="Left" LabelStyle-StyleReference="title"
CommandStyle-StyleReference="subcommand" AutoGenerateFields="False"
LabelField="fCarDescription" BackCommandText="Back to list" MoreText="More
items" DetailsCommandText="Car details" EnableViewState="true"
LabelStyle-Font-Bold="True">
<Field Name="fCarDescription" DataField="CarDescription"
Visible="False" Title="Car description" />
<Field Name="fMake" DataField="MakeDescription" Visible="True"
Title="Make" />
<Field Name="fModel" DataField="ModelDescription" Visible="True"
Title="Model" />
<Field Name="fVersion" DataField="VersionDescription" Visible="True"
Title="Version" />
<Field Name="fParkingPlace" DataField="parkingPlace" Visible="True"
Title="Parking place" />
<Command Name="VersionDetails" Text="Version details" />
</mobile:ObjectList>
</mobile:Form>

Private Sub carList_ItemCommand(ByVal sender As Object, ByVal e As
System.Web.UI.MobileControls.ObjectListCommandEventArgs) Handles
carList.ItemCommand
Dim textControlObj As MobileControls.TextView
Dim labelControlObj As MobileControls.Label
textControlObj = New MobileControls.TextView()
textControlObj.Text = carList.SelectedIndex.ToString()
carDetails.Controls.Add(textControlObj)
ActiveForm = Me.carDetails
End Sub

Thanks for all your comments.
Geert


1 Answer

Geert Maesele

6/20/2002 12:16:00 PM

0

Solved my problem by setting the enableViewState property of the form to
true.

Geert


"Geert Maesele" <geert.maesele@REPLYandersen.com> wrote in message
news:#NLz7K4FCHA.2552@tkmsftngp05...
> Hi all
>
> I'm having two problems when using of an objectlist.
> 1. On the OpenWave 4.1 emulator my code goes in error when I add a
> command to my objectlist. It says that there is no element selected, when
I
> want to see the details of an item in the objectlist.
> 2. On other browsers I cann't retrieve the selected element. When I
> request the selectedIndex property of the object list I get -1.
>
> Any ideas?
> Here is my code.
>
> <mobile:Form id="searchResults" runat="server" Paginate="True"
> PagerStyle-NextPageText="Next page" PagerStyle-PreviousPageText="Previous
> page">
> <mobile:ObjectList id="carList" runat="server" ItemsPerPage="5"
> Alignment="Left" LabelStyle-StyleReference="title"
> CommandStyle-StyleReference="subcommand" AutoGenerateFields="False"
> LabelField="fCarDescription" BackCommandText="Back to list" MoreText="More
> items" DetailsCommandText="Car details" EnableViewState="true"
> LabelStyle-Font-Bold="True">
> <Field Name="fCarDescription" DataField="CarDescription"
> Visible="False" Title="Car description" />
> <Field Name="fMake" DataField="MakeDescription" Visible="True"
> Title="Make" />
> <Field Name="fModel" DataField="ModelDescription" Visible="True"
> Title="Model" />
> <Field Name="fVersion" DataField="VersionDescription"
Visible="True"
> Title="Version" />
> <Field Name="fParkingPlace" DataField="parkingPlace"
Visible="True"
> Title="Parking place" />
> <Command Name="VersionDetails" Text="Version details" />
> </mobile:ObjectList>
> </mobile:Form>
>
> Private Sub carList_ItemCommand(ByVal sender As Object, ByVal e As
> System.Web.UI.MobileControls.ObjectListCommandEventArgs) Handles
> carList.ItemCommand
> Dim textControlObj As MobileControls.TextView
> Dim labelControlObj As MobileControls.Label
> textControlObj = New MobileControls.TextView()
> textControlObj.Text = carList.SelectedIndex.ToString()
> carDetails.Controls.Add(textControlObj)
> ActiveForm = Me.carDetails
> End Sub
>
> Thanks for all your comments.
> Geert
>
>