This is my first time to paint a client web page from inside a webmethod function.
Please help and tell me why this syntax is wrong?
This is the all function – that works fine:
[WebMethod]
public IList<OrderViewDTO> GetTaskProgress(DateTime xDATEx)
{
try
{
var xDate2 = xDATEx.AddDays(1);
new OrderDataRepository()
.GetAllOrderData()
.Where(x=>x.POD_DATE>=xDATEx && x.POD_DATE < xDate2)
.GroupBy(o => o.User)
.Select(g => new OrderViewDTO
{
DriverId = g.Key.Id,
PdriverName = g.Key.Name,
OrderCount = g.Count(),
OrderCountWhereNameIsNotNull = g.Count(o => o.RECEIVE_NAME != null)
})
.ToList();
can you please show me how to print a div and a values like <%# Eval(“DriverName”) %> inside the div inside the above function
instead of my original code:
<asp:Repeater ID="DataViewer" runat="server">
<ItemTemplate>
<div style='border: 1px; width: 600px; overflow-x: auto; overflow-y: hidden;'>
<div style='float: left;'>
<%# Eval("DriverName") %>
</div>
<div style='border: 3px solid black; float: left; width: <%# Convert.ToInt32(Eval("OrderCount")) * 50 %>px'>
<div style='border: 0px; float: left; width: <%# ((Convert.ToDouble(Eval("OrderCount")) - Convert.ToDouble(Eval("OrderCountWhereNameIsNotNull"))) / Convert.ToDouble(Eval("OrderCount"))) * 100 %>%;'>
<%# Eval("OrderCount") %></div>
<div style='border: 0px; float: right; width: <%# (Convert.ToDouble(Eval("OrderCountWhereNameIsNotNull")) / Convert.ToDouble(Eval("OrderCount"))) * 100 %>%;
background-color: red;'>
<%# Eval("OrderCountWhereNameIsNotNull") %></div>
</div>
</div>
<br />
</ItemTemplate>
</asp:Repeater>
Stab in the dark, it looks like you are appending the table rows for the ordersPage.Items to HTML in structure which alredy has closed its table tag.
Take the closing table tag out of structure where you are initializing it, and instead append it to structure AFTER the $.each on ordersPage.Items.