Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Mobile > Can't seem to get ItemDetailsTemplate to work for me :(

Reply
Thread Tools

Can't seem to get ItemDetailsTemplate to work for me :(

 
 
Rich
Guest
Posts: n/a
 
      09-29-2004
I have an ObjectList which I am populating from a SQL Server database (a join
accross several tables). I have customized the ObjectList display with
ItemTemplate and Alternating ItemTemplate, and pass CommandName to the
ItemCommand message handler so that the user can either drill into the item
details or perform a followon task associated with the item. When I use the
default item details display all is well. However, I would like to customize
the item details display just as I have customized the parent item display. I
tried to closely follow the example in Wigley/Roxburgh's "Building Microsoft
ASP.NET Applications for Mobile Devices", but the customized item details
page does not contain my data (although a "view source" in IE6 shows that the
"<br />" tags in my ItemDetailsTemplate did get passed to the details page).
Any idea why I am not getting the "meat" of my data
(start;lastname;firstname;name)?

Here is part of the code from the aspx page:
<mobile:ObjectList id="olstTask" runat="server" ItemsPerPage="5"
CommandStyle-StyleReference="subcommand" LabelStyle-StyleReference="title"
Font-Size="Small" TableFields="start;lastname;firstname;name">
<Field Title="Due" DataFormatString="{0:MM/d h:mm}"
DataField="start"></Field>
<Field Title="Patient" DataField="lastname"></Field>
<Field DataField="firstname"></Field>
<Field Title="Task" DataField="name"></Field>
<DeviceSpecific>
<Choice Filter="isHTML32"
Xmlns="http://schemas.microsoft.com/mobile/html32template">
<HeaderTemplate>
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="300" border="0">
<TR>
<TD><IMG alt="Sea State 1" src="ss1_logo.png"></TD>
</TR>
</HeaderTemplate>
<ItemTemplate>
<TR>
<TD><asp:LinkButton ID="lbnStart" CommandName="doTask" Runat="server">
<%# ((ObjectListItem)Container)["start"] %></asp:LinkButton>
</TD>
<TD><%# ((ObjectListItem)Container)["lastname"] %></TD>
<TD><%# ((ObjectListItem)Container)["firstname"] %></TD>
<TD><asp:LinkButton ID="lbnTask" CommandName="details" Runat="server">
<%# ((ObjectListItem)Container)["name"] %></asp:LinkButton></TD>
</TR>
</ItemTemplate>
<AlternatingItemTemplate>
<TR bgcolor="#ccffcc">
<TD>
<asp:LinkButton ID="lbnStart_alt" CommandName="doTask" Runat="server">
<%# ((ObjectListItem)Container)["start"] %>
</asp:LinkButton>
</TD>
<TD><%# ((ObjectListItem)Container)["lastname"] %></TD>
<TD><%# ((ObjectListItem)Container)["firstname"] %></TD>
<TD>
<asp:LinkButton ID="lbnTask_alt" CommandName="details" Runat="server">
<%# ((ObjectListItem)Container)["name"] %>
</asp:LinkButton>
</TD>
</TR>
</AlternatingItemTemplate>
<ItemDetailsTemplate>
<%#
DataBinder.Eval(((ObjectList)Container.NamingConta iner).Selection.DataItem,
"start", "Due to start: {0}") %>
<br/>
<%#
DataBinder.Eval(((ObjectList)Container.NamingConta iner).Selection.DataItem,
"firstname", "Patient name: {0}") %>
<%#
DataBinder.Eval(((ObjectList)Container.NamingConta iner).Selection.DataItem,
"lastname", " {0}") %>
<br/>
<%#
DataBinder.Eval(((ObjectList)Container.NamingConta iner).Selection.DataItem,
"name", "Task: {0}") %>
</ItemDetailsTemplate>
<FooterTemplate>
</TABLE>
</FooterTemplate>
</Choice>
</DeviceSpecific>
</mobile:ObjectList>

 
Reply With Quote
 
 
 
 
Nozomu Hirose
Guest
Posts: n/a
 
      11-14-2004
The following worked for me:

<%#
((ObjectListItem)(((ObjectList)(Container.NamingCo ntainer)).Selection))["something"] %>

I could not make DataBinder.Eval work for me, so I used this.
You may use String.Format to format your data.



 
Reply With Quote
 
 
 
 
Rich
Guest
Posts: n/a
 
      11-20-2004
Great tip! It worked very well. Thanks.

"Nozomu Hirose" wrote:

> The following worked for me:
>
> <%#
> ((ObjectListItem)(((ObjectList)(Container.NamingCo ntainer)).Selection))["something"] %>
>
> I could not make DataBinder.Eval work for me, so I used this.
> You may use String.Format to format your data.
>
>
>

 
Reply With Quote
 
Trine
Guest
Posts: n/a
 
      11-23-2004
Please has anyone tried to add a checkbox column to an obejctlist AND
suceeded in taking a boolean value from a dataset to check or uncheck it.
I have the following code which give me a devicespecific templated checkbox
(it only displays a checkbox) :

<mobile:SelectionList SelectType="ChekcBox" ..... >
<Item Selected='<%#
Convert.ToBoolean(((ObjectListItem)(((ObjectList)( Container.NamingContainer)).Selection))["primaryvalue"])%></Item>
</mobile:SelectionList>

in another objectlist I try a different approach and this code brings me the
boolean value in text:
<Field Title="Primary Value" Name="primaryvalue"
DataField="primaryvalue"></Field>

but I cant seem to make the two things work together. Any suggestions?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't seem to get 802.1x to work psychogenic Cisco 4 06-27-2006 08:49 PM
Help with hyperlinkcolumn, I can't seem to get it work! =?Utf-8?B?Q2hyaXM=?= ASP .Net 4 02-02-2005 08:17 PM
Can't seem to get debugger to work tfs ASP .Net 1 06-28-2004 09:49 PM
Error downloading page, some pages work great but cant seem to get this one Jack Schafer Perl 1 04-23-2004 08:32 AM
ObjectList <ItemDetailsTemplate> Ersin Inan ASP .Net Mobile 0 01-12-2004 03:49 PM



Advertisments