Hi AG,
My name is Allen Chen. It's my pleasure to work with you on this issue.
From your description you want to display one field in two columns and use
unordered list to display data.
To solve this problem I need to know the expected layout. Since it's not
given yet I'd like to provide solution based on my assumption first. See
below:
1. The layout is like this:
* Part one of Record1 Part two of Record1
* Part one of Record2 Part two of Record2
* Part one of Record3 Part two of Record3
....
If this is what you need I think you can try following code:
<asp:ListView ID="ListView1" runat="server"
DataSourceID="LinqDataSource1" >
<LayoutTemplate>
LayoutTemplate
<ul>
<asp
laceHolder runat="server" ID="itemPlaceholder"></asp
laceHolder>
</ul>
</LayoutTemplate>
<ItemTemplate>
<li>
<div style="width:500px;">
<div style="width:50%;float:left; background-color:Yellow">
<%#Eval("CompanyName") %> -1</div>
<div style="width:50%;float:right;background-color:Green">
<%#Eval("CompanyName") %> -2</div>
<div style='clear:both;'></div>
</div>
</li>
</ItemTemplate>
</asp:ListView>
To get the expected value you need you can replace <%#Eval("CompanyName")
%> -1 with <%#YourMethod(Eval("CompanyName")) %> and in code behind, define
YourMethod like this:
protected string YourMethod(object data)
{
//return the length of the data retrieved.
return "length is: " + data.ToString().Length;
}
2. The layout is like this:
* Part one of Record1 * Part two of Record1
* Part one of Record2 * Part two of Record2
* Part one of Record3 * Part two of Record3
...
In this case the rendered HTML I can think of is like this:
<table>
<tr>
<td>
<ul>
<li>Part one of Record1</li>
<li>Part one of Record2</li>
<li>Part one of Record3</li>
.......
</ul>
</td>
<td>
<ul>
<li>Part two of Record1</li>
<li>Part two of Record2</li>
<li>Part two of Record3</li>
.......
</ul>
</td>
</tr>
</table>
If this is what you need I think we have to use two ListView to render the
above HTML.
Another way to simulate the layout is like below:
<asp:ListView ID="ListView1" runat="server"
DataSourceID="LinqDataSource1" >
<LayoutTemplate>
LayoutTemplate
<asp
laceHolder runat="server" ID="itemPlaceholder"></asp
laceHolder>
</LayoutTemplate>
<ItemTemplate>
<div style="width:500px; height:50px;">
<div style="width:50%; height:100%; float:left; background-color:Yellow">
<ul>
<li>
<%#YourMethod(Eval("CompanyName")) %>
</li>
</ul>
</div>
<div style="width:50%; height:100%;float:right;background-color:Green">
<ul>
<li>
<%#Eval("CompanyName") %> -2
</li>
</ul>
</div>
<div style='clear:both;'></div>
</div>
</ItemTemplate>
</asp:ListView>
The above code will not render that HTML but the outcome is a similar
layout.
Please let me know which one meets your requirement. If none of them does
please clarify your requirement. You can paste the expected HTML for me to
understand it.
Regards,
Allen Chen
Microsoft Online Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 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. 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/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.