RE: ObjectList Data-Binding to a List<MyClass>



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


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.






.



Relevant Pages

  • RE: FileUpload Control on Mobile Form
    ... a standard html based ASP.NET page will save much effort. ... Microsoft MSDN Online Support Lead ... Regarding on the ASP.NET mobile page fileuploading issue, ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Opening an HTML page with VB6
    ... open and display the HTML page, ... Can I use any of the standard controls that come with VB6 to view HTML files? ... You have to resort to using a "custom" control. ... then I will need to spawn a browser - could someone please show how I may launch a browser to open the HTML file? ...
    (microsoft.public.vb.general.discussion)
  • Re: oe6 reading mail showing as html raw source?
    ... > CWShredder, Ad-aware, Spybot, HijackThis ... > the Windows Profile is damaged, not OE or any identities, and, barring ... That control is, apparently, being fed from ... normal data and is being transcoded into HTML improperly. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re:
    syntax
    ... control categories Coward 9. ... "HTML", but my initial point is still true that there is no category ... and why your initial term "ASP.NET HTML Form Control" is incorrect). ... representation (and not accesible by the developer via server-side code). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: syntax
    ... But you should not nitpick while posting mistaken information. ... "HTML" as I stated). ... "ASP.NET HTML Form Control". ... extremly limited server-side representation (and not accesible by the developer via server-side ...
    (microsoft.public.dotnet.framework.aspnet)

Loading