G
Guest
Hi. I have finally figured out the basics of the ObjectList control that I'm
using for Mobile. Now I need help with some stuff that's a little more
complex in actually binding data.
Let's say that I have a Default.aspx and a Default.aspx.cs. On the
Default.aspx I have created an ObjectList that looks like:
<mobile:ObjectList ID="PicsOL" Runat="server"
CommandStyle-StyleReference="subcommand" AutoGenerateFields="true"
LabelStyle-StyleReference="title" >
<DeviceSpecific>
<Choice>
<ItemTemplate>
<mobile:Image ImageUrl="" Runat="server" />
<mobile:Label Runat="server">
<%# Eval("ID") %>
</mobile:Label>
<mobile:Label Runat="server">
<%# Eval("UserTitle") %>
</mobile:Label>
<br />
</ItemTemplate>
</Choice>
</DeviceSpecific>
<Field Title="ID" DataField="ID" />
<Field Title="UserTitle" DataField="UserTitle" />
</mobile:ObjectList>
But I have a question: Let's say that I want to do something simple but a
little more complicated than just Eval("ID"). What If I want to run the value
of ID through a function that I have created (say, on my .cs code-behind
page). Let's say the function is something like
int MyFunction(int ID)
How do I get that into the <%# %> of the data-bound item in the list? I've
tried lots of different global objects and noting works. Says the server tag
is not well formed.
I know that this is doable, but I don't really understand the syntax.
Help much appreciated!
Alex
using for Mobile. Now I need help with some stuff that's a little more
complex in actually binding data.
Let's say that I have a Default.aspx and a Default.aspx.cs. On the
Default.aspx I have created an ObjectList that looks like:
<mobile:ObjectList ID="PicsOL" Runat="server"
CommandStyle-StyleReference="subcommand" AutoGenerateFields="true"
LabelStyle-StyleReference="title" >
<DeviceSpecific>
<Choice>
<ItemTemplate>
<mobile:Image ImageUrl="" Runat="server" />
<mobile:Label Runat="server">
<%# Eval("ID") %>
</mobile:Label>
<mobile:Label Runat="server">
<%# Eval("UserTitle") %>
</mobile:Label>
<br />
</ItemTemplate>
</Choice>
</DeviceSpecific>
<Field Title="ID" DataField="ID" />
<Field Title="UserTitle" DataField="UserTitle" />
</mobile:ObjectList>
But I have a question: Let's say that I want to do something simple but a
little more complicated than just Eval("ID"). What If I want to run the value
of ID through a function that I have created (say, on my .cs code-behind
page). Let's say the function is something like
int MyFunction(int ID)
How do I get that into the <%# %> of the data-bound item in the list? I've
tried lots of different global objects and noting works. Says the server tag
is not well formed.
I know that this is doable, but I don't really understand the syntax.
Help much appreciated!
Alex