RE: ObjectList Data-Binding to a List<MyClass>
- From: Alex Maghen <AlexMaghen@xxxxxxxxxxxxxxxx>
- Date: Tue, 4 Sep 2007 08:48:04 -0700
Actually, the problem, it turns out, was that I was using
<ItemDetailsTemplate> when I should have been using <ItemTemplate>. When I
use that instead, the thing does what I need. I really appreciate all your
help. One suggestion: The whole ObjectList, DeviceSpecific, etc., etc.
business is, in my opinion, VERY poorly documented. Usually, you guys do a
really good job of definition, how-to, etc. In this area, the documentation
is really very poor.
In any case, I'm okay now. I really appreciate all your help.
Thanks.
Alex
"Steven Cheng[MSFT]" wrote:
Thanks for your followup Alex,.
For the "ItemDetailsTemplate" template issue you mentioned, it maybe still
due to the control use the default template since there may have any other
setting and prevent your custom one from display. Yes, mobile control is
not natually targeting html from its designate, so that does make us feel
abit inconvenient when we want to author standard html/xhtml content for
mobile page.
BTW, as most smart devices not support html and asp.net standard
application control also have adaptable rendering model, maybe you can
consider use a standard aspx page here as you will mostly use html based
content. Is this possible in your application?
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: ObjectList Data-Binding to a List<MyClass>
Date: Fri, 31 Aug 2007 07:52:01 -0700
adding
Steven -
One more note: I have successfully gotton it to show both columns by
TableFields="ID;UserTitle"It
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>.
just ignores that and only displays the <mobile: Label...> objects that Iother
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
kind of list). I have that *so* easily with the Repeater control instandard
ASPX which allows me to repeat *anyuthing* over and over again based onrows
from a List. What that markup is that is sent to the browser is up to meand
if I include items that the browser can't handle, that's *my* problem. Whyand am
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
ofjust getting back to it now. I must say, I find this entire approach
*incredibly* complicated for something as simple as providing a listing
doobjects/assets from a List or Database table. But there's nothing I can
understand.about it, I guess so I have to keep bothering you until I really
theI implemented exactly what you defined below and I'm no longer getting
%>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")
alsoand another whose content is set to <%# Eval("UserTitle") %>. I then
foradded 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
thethe "UserTitle" is simply not shown. Also, in your sample, you placed
istext "detail template:" just inside the <ItemDetailsTemplate> tag. This
everyliteral text and I would have assumed that it would just show up in
"Mobilerow. 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
error youRepeater", correct?
I've performed test through the code you provided and did met the
offsaid. After some research, I found that the error is caused by no data
fields are defined in the ObjectList control. Actually, if you turn
want"AutoGenerateFields" in ObjectList, you need to supply the fields you
AutoGenerateFields="False"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"
Eval("UserTitle")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"><%#
if you%></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
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifneed 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
issuesications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent
followwhere an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
theup response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
situationsmost efficient resolution. The offering is not appropriate for
bestthat require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
contactinghandled working with a dedicated Microsoft Support Engineer by
rights.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
- Follow-Ups:
- RE: ObjectList Data-Binding to a List<MyClass>
- From: Steven Cheng[MSFT]
- RE: ObjectList Data-Binding to a List<MyClass>
- References:
- RE: ObjectList Data-Binding to a List<MyClass>
- From: Steven Cheng[MSFT]
- RE: ObjectList Data-Binding to a List<MyClass>
- Prev by Date: Re: How to Track User Login
- Next by Date: Re: File system or Database
- Previous by thread: RE: ObjectList Data-Binding to a List<MyClass>
- Next by thread: RE: ObjectList Data-Binding to a List<MyClass>
- Index(es):
Relevant Pages
|
Loading