RE: ObjectList Data-Binding to a List<MyClass>
- From: Alex Maghen <AlexMaghen@xxxxxxxxxxxxxxxx>
- Date: Fri, 31 Aug 2007 07:52:01 -0700
Steven -
One more note: I have successfully gotton it to show both columns by adding
TableFields="ID;UserTitle"
to the <mobile:ObjectList...> tag. But I still can't get it to display
standard text of mark-up that I have placed in the <ItemDetailsTemplate>. It
just ignores that and only displays the <mobile: Label...> objects that I
have bound to my data fields. What is *with* this control?! Why is it so
constrained? All I want is a control that allows me to manually build HTML
markup for each object in a list (whether a database DataTable or some other
kind of list). I have that *so* easily with the Repeater control in standard
ASPX which allows me to repeat *anyuthing* over and over again based on rows
from a List. What that markup is that is sent to the browser is up to me and
if I include items that the browser can't handle, that's *my* problem. Why
can't I do that in mobile. Sorry, but this is incredibly frustrating for
something so simple.
As always, thanks!
Alex
"Alex Maghen" wrote:
Steven -.
Thanks for getting back to me about all these posts. I have been away and am
just getting back to it now. I must say, I find this entire approach
*incredibly* complicated for something as simple as providing a listing of
objects/assets from a List or Database table. But there's nothing I can do
about it, I guess so I have to keep bothering you until I really understand.
I implemented exactly what you defined below and I'm no longer getting the
error I was getting before, but I *am* still having a problem:
In the <ItemDetailsTemplate> section (below), I've presented two
<mobile:Label ...> objects, one whose content is set to: <%# Eval("ID") %>
and another whose content is set to <%# Eval("UserTitle") %>. I then also
added the two <Field...> tags for ID and UserTitle below (just as you
defined). When I run this, though, all I see is a "table" with a single
column showing the "ID" header and "ID" entries only. The second label for
the "UserTitle" is simply not shown. Also, in your sample, you placed the
text "detail template:" just inside the <ItemDetailsTemplate> tag. This is
literal text and I would have assumed that it would just show up in every
row. Instead, it doesn't show up at all.
Can you please help? This is an incredibly complicated way of doing
something really simple - or so it seems.
Thanks as always.
Alex
"Steven Cheng[MSFT]" wrote:
Hi Alex,
Seems this is a continual post from a former thread discussing on "Mobile
Repeater", correct?
I've performed test through the code you provided and did met the error you
said. After some research, I found that the error is caused by no data
fields are defined in the ObjectList control. Actually, if you turn off
"AutoGenerateFields" in ObjectList, you need to supply the fields you want
to use in your ObjectList. You should use the <Field > element to add
fields definition into the ObjectList.
For your "TestClass" scenario, here is the expected ObjectList aspx
template:
================
<mobile:ObjectList ID="ObjectList1" Runat="server"
CommandStyle-StyleReference="subcommand"
LabelStyle-StyleReference="title" AutoGenerateFields="False"
LabelField="UserTitle" >
<DeviceSpecific ID="ds_ol1" Runat="server">
<Choice >
<ItemDetailsTemplate>
detail template:
<mobile:Label ID="Label1" Runat="server"><%# Eval("ID")
%></mobile:Label>
<mobile:Label ID="Label2" Runat="server"><%# Eval("UserTitle")
%></mobile:Label>
</ItemDetailsTemplate>
</Choice>
</DeviceSpecific>
<Field Title="ID" DataField="ID" />
<Field Title="UserTitle" DataField="UserTitle" />
</mobile:ObjectList>
========================
Also, I found a good web forum thread which has included some advanced
setting and usage upon ObjectList control, you can also have a look if you
need some further customzation or event handling:
http://forums.asp.net/p/1146753/1862202.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- References:
- ObjectList Data-Binding to a List<MyClass>
- From: Alex Maghen
- RE: ObjectList Data-Binding to a List<MyClass>
- From: Steven Cheng[MSFT]
- RE: ObjectList Data-Binding to a List<MyClass>
- From: Alex Maghen
- ObjectList Data-Binding to a List<MyClass>
- Prev by Date: RE: ObjectList Data-Binding to a List<MyClass>
- Next by Date: Re: Doubt global variable?
- Previous by thread: RE: ObjectList Data-Binding to a List<MyClass>
- Next by thread: Retrieving id field ?
- Index(es):
Relevant Pages
|
Loading