[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

ObjectList Control and AlternatingItemTemplates

MHoward

4/3/2002 8:59:00 PM

Hello,

Is there a way to do the following?

Toolset used:

Vb .NET
Mobile ObjectList Control
DataView

I'm trying to use the ObjectList Control to render
alternating color rows. I've seen examples using the List
control with the Data Source being an array and the Data
Binding happening at design time. In my implementation
the Data Source is a Data View and the Data Binding takes
place at run time. At this point I'm not sure if I need
to set a property of the Object List in the aspx page or
in the Code Behind.

Here's what I've tried so far:

<mobile:ObjectList id="Objectlist2" runat="server"
LabelStyle-StyleReference="title" CommandStyle-
StyleReference="subcommand">

<DeviceSpecific>
<Choice Filter="isHTML32">

<HeaderTemplate>

<table
width="100%">

</HeaderTemplate>

<ItemTemplate>

<tr
bgcolor="#cccccc">


<td>


<mobile:Link runat="server" ID="Link2">


<%#DataBinder.Eval
(((ObjectListItem)Container).DataItem,"Title")%> Note:
Title is the LabelField.


</mobile:Link>


</td>

</tr>

</ItemTemplate>


<AlternatingItemTemplate>

<tr
bgcolor="#eeeeee">


<td>


<%#DataBinder.Eval(((ObjectListItem)
Container).DataItem,"Title")%>


</td>

</tr>


</AlternatingItemTemplate>

<FooterTemplate>


</table>


</FooterTemplate>

</Choice>

</DeviceSpecific>

</mobile:ObjectList>



Thank You in advance for you help,

3 Answers

(Simon Calvert)

4/4/2002 5:47:00 PM

0

MHoward

4/4/2002 7:04:00 PM

0

Hey Simon,
thanks for responding. I have the objlist binding to the
dataview fine. It's when I render the data, I want to
display my lable field as Alternating color rows. Because
I'm binding at run time the samples I've seen don't work
for me.
MHoward
>-----Original Message-----
>Can you include the code-behind sample if the following
does not work for
>you.
>
>Assuming you have a valid daasource, (i.e data filled
correctly etc.). You
>can set the datasource for ObjectList2 in the code-
behind, and DataBind(),
>For example in C#
>
>if (!IsPostBack())
>{
> objectList2.DataSource = MyDataView;
> DataBind();
>}
>
>Or use the properties of the ObjectList control to
define the DataSource.
>You'll still need to make sure you call DataBind(),, on
the object or the
>page in the code behind in the Page_Load(),
>
>You could also use script on the ASPX, to perform the
same function as the
>code-behind.
>
>Simon Calvert
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>You assume all risk for your use. © 2002 Microsoft
Corporation. All rights
>reserved.

(Simon Calvert)

5/6/2002 6:11:00 PM

0