Listview Layout Template Error - asp.net

I am querying a column from my db and when I test the query with the sqldatasource the numbers shows up fine. However, when I run the application, all the numbers in the column add two zeros at the end of it.
For example,
Instead of 1 it is 100
Instead of 2 it is 200
I dont know what the cause of this may be.
Here is my LayoutTemplate:
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr runat="server" style="background-color: #E0FFFF;color: #333333; ">
<th runat="server"></th>
<th runat="server"> FormTitle</th>
<th runat="server">FormSection</th>
<th runat="server">SubSection</th>
<th runat="server">SectionItem</th>
<th runat="server">SortOrder</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF">
<asp:DataPager ID="DataPager1" runat="server" PageSize="7">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
ItemTemplate:
<ItemTemplate>
<tr style="background-color: #E0FFFF;color: #333333;">
<td>
<asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" />
<asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
</td>
<td>
<asp:Label ID="FormTitleLabel" runat="server" Text='<%# Eval("FormTitle") %>' />
</td>
<td>
<asp:Label ID="FormSectionLabel" runat="server" Text='<%# Eval("FormSection") %>' />
</td>
<td>
<asp:Label ID="SubSectionLabel" runat="server" Text='<%# Eval("SubSection") %>' />
</td>
<td>
<asp:Label ID="SectionItemLabel" runat="server" Text='<%# Eval("SectionItem") %>' />
</td>
<td>
<asp:Label ID="SortOrder" runat="server" Text='<%# Eval("SortOrder") %>' />
</td>
</tr>
</ItemTemplate>

Related

Showing same table to different roles with different options

Currently I just post the same code in different pages for each role, a repeater with a table like this one but each role has different options to do. I tried to place in loginview separator but didn't work, i don't know how to iterate through login view controls and the code just started getting dirtier more than just doing visible = false / true. Is there a more effective way to do this than just making new pages?
<asp:Repeater ID="rptArtigos" runat="server" OnItemCommand="rptArtigos_OnItemCommand" OnItemDataBound="rptArtigos_OnItemDataBound">
<HeaderTemplate>
<table id="tblArtigos" class="table table-bordered dataTable text-center">
<thead class="thead-dark">
<tr>
<th>ID</th>
<th>Ref. Cliente</th>
<th>Ref. Interna</th>
<th>Nome</th>
<th>Estado</th>
<th>Válido Logística</th>
<th>Data Criação</th>
<th></th>
<th></th>
<th id="cell1" runat="server"></th>
<th></th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tbody>
<tr>
<td>
<asp:Label ID="lblIdArtigo" runat="server" Text='<%# Eval("IdArtigo") %>' />
</td>
<td>
<asp:Label ID="lblRefCliente" runat="server" Text='<%# Eval("ReferenciaCliente") %>' />
</td>
<td>
<asp:Label ID="lblRefInterna" runat="server" Text='<%# Eval("ReferenciaInterna") %>' />
</td>
<td>
<asp:LinkButton ID="lkbtnNome" runat="server" Text='<%# Eval("Nome") %>' CommandName="Ver" CommandArgument='<%# Eval("IdArtigo") %>'></asp:LinkButton>
</td>
<td>
<asp:Label ID="lblEstado" runat="server" Text='<%# Eval("EstadoArtigo") %>' />
</td>
<td>
<asp:Label ID="lblAprovadoLogistica" runat="server" Text='<%# Eval("AprovadoLogistica") %>' />
</td>
<td>
<asp:Label ID="lblDataCriacao" runat="server" Text='<%# Eval("DataCriacao") %>' />
</td>
<td class="text-center">
<asp:ImageButton ImageUrl="/Images/Icones/copy.png" Width="25" runat="server" CommandName="Copiar" CommandArgument='<%# Eval("IdArtigo") %>' />
</td>
<td class="text-center">
<asp:ImageButton ImageUrl="/Images/Buttons/edit.png" Width="25" runat="server" CommandName="Editar" CommandArgument='<%# Eval("IdArtigo") %>' />
</td>
<td class="text-center">
<asp:ImageButton ImageUrl="/Images/Buttons/success.png" Width="25" runat="server" OnClientClick="return false;" data-toggle="modal" data-target="#validate" CommandName="Validar" CommandArgument='<%# Eval("IdArtigo") %>' />
</td>
<td class="text-center">
<asp:ImageButton ImageUrl="/Images/Buttons/x-button.png" Width="25" runat="server" CommandName="Rejeitar" CommandArgument='<%# Eval("IdArtigo") %>' />
</td>
</tr>
</tbody>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

ListView - ItemTemplate table styling

I am trying to create an ItemTemplate using a 4x3 table. I want the first column to contain an image and the cells in the other columns info about the image. I am using the code below but the 1st row renders at the bottom of the image and the 2nd row below it. What am I doing wrong?
Thanks in advance.
<LayoutTemplate>
<table runat="server" cellpadding="2" id="tblBooks" style="">
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderContainer" runat="server" border="0" style="">
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server" style="">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td rowspan="4">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# String.Format("~\\Static\\Images\\BookCovers\\{0}", Eval("CoverImageSmall")) %>' Height="120" Width="90"/>
</td>
<td colspan="2" style="font-size:large; padding-bottom:5px; padding-left:10px; color:Black;">
<asp:Label runat="server" ID="TitleLabel" Text='<%# Eval("Title") %>' />
</td>
</tr>
<tr runat="server">
<td colspan="2" style="padding-left:10px;">
<asp:Label runat="server" ID="FirstNameLabel" Text='<%# Eval("FirstName") %>' />
<asp:Label runat="server" ID="LastNameLabel" Text='<%# Eval("LastName") %>' />
</td>
</tr>
<tr runat="server">
<td colspan="2" style="padding-left:10px;">
</td>
</tr>
<tr runat="server">
<td>
</td>
<td>
</td>
</tr>
</ItemTemplate>
EDIT: To be more clear, the result I am after is like this:
______________________________________________
| |___________Title_____________|
| Image |____________Name_____________|
| |______Value_____|____Value___|
|_______________|______Value_____|____Value___|
But what I get is this:
______________________________________________
| _____________ | |
|| Image | | |
|| | | |
||____________| |___________Title_____________|
| |____________Name_____________|
| |______Value_____|____Value___|
|_______________|______Value_____|____Value___|
The CSS is reset.
The rowspan automatically makes the column and all the other rows/cells will be added around it. You can remove all the colspans and the second td in the last row.
<ItemTemplate>
<tr runat="server">
<td rowspan="4">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# String.Format("~\\Static\\Images\\BookCovers\\{0}", Eval("CoverImageSmall")) %>' Height="120" Width="90"/>
</td>
<td style="font-size:large; padding-bottom:5px; padding-left:10px; color:Black;">
<asp:Label runat="server" ID="TitleLabel" Text='<%# Eval("Title") %>' />
</td>
</tr>
<tr runat="server">
<td style="padding-left:10px;">
<asp:Label runat="server" ID="FirstNameLabel" Text='<%# Eval("FirstName") %>' />
<asp:Label runat="server" ID="LastNameLabel" Text='<%# Eval("LastName") %>' />
</td>
</tr>
<tr runat="server">
<td style="padding-left:10px;">
</td>
</tr>
<tr runat="server">
<td>
</td>
</tr>
</ItemTemplate>
UPDATE: Based on the supplied jsfiddle, it shows the issue is with the use of the vertical-align:baseline attribute applied by the reset css stylesheet. If that CSS attribute is removed, or is overridden for the title cell to something like vertical-align:bottom it displays as expected. See http://jsfiddle.net/9HsvF/10/
I have write down a simple code: <tr> <td>Image Code</td> <td colspan="2">Title</td></tr><tr> <td rowspan="3"><td> <td colspan="2">Name</td></tr><tr> <td>Value1<td> <td>Value2</td></tr><tr> <td>Value1<td> <td>Value2</td></tr>
Try this with your code. Hope it will work as you want.

How to get this ListView as a two-column table?

I am a new ASP.NET developer and I am struggling in getting the ListView that I am working on it as the image shown below:
How to do that?
My ASP.NET Code:
<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" >
<ItemTemplate>
<tr style="">
<td>
<p>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</p>
</th>
<td>
<p>
<asp:Label ID="UsernameLabel" runat="server"
Text='<%# Eval("Username") %>' />
</p>
</td>
<td>
<p>
<asp:Label ID="JobTitleLabel" runat="server" Text='<%# Eval("JobTitle") %>' />
</p>
</td>
<td>
<p>
<asp:Label ID="DivisionLabel" runat="server" Text='<%# Eval("DivisionName") %>' />
</p>
</td>
<td>
<p>
<asp:Label ID="RoleLabel" runat="server" Text='<%# Eval("RoleName") %>' />
</p>
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table id="Table2" runat="server">
<tr id="Tr5" runat="server">
<td id="Td4" runat="server">
<table ID="itemPlaceholderContainer" runat="server" border="1" style="">
<tr id="Tr6" runat="server">
<td id="Td6" runat="server" colspan="3">
<center>Personal Information</center>
</td>
</tr>
<tr id="Tr9" runat="server" style="">
<th id="Th3" runat="server">
Name</th>
</tr>
<tr id="Tr10" runat="server">
<th id="Th4" runat="server">
Username</th>
</tr>
<tr id="Tr11" runat="server">
<th id="Th5" runat="server">
JobTitle</th>
</tr>
<tr id="Tr12" runat="server">
<th id="Th6" runat="server">
Badge Number</th>
</tr>
<tr id="Tr13" runat="server">
<th id="Th7" runat="server">
Division</th>
</tr>
<tr id="Tr14" runat="server">
<th id="Th8" runat="server">
Role</th>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr id="Tr8" runat="server">
<td id="Td7" runat="server" style="">
<asp:DataPager ID="DataPager1" runat="server" PageSize="5">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
What I am getting right now is listing the headers or titles on the left column and the retreived values underneath them in a one instead of showing each value with its header. Here's a snapshot of what I am getting right now:
UPDATE:
UPDATE #2:
I am still struggling with this issue and getting the same result as in the snapshot.
Your html is so massive.
<tr style="">
**<td>**
<p>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</p>
**</th>**
see a mark **.Open td and closing with th.
<tr style="">
<td>
<p>
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</p>
</th>
<td>
<p>
<asp:Label ID="UsernameLabel" runat="server"
Text='<%# Eval("Username") %>' />
</p>
</td>
Close your tr after above code and reopen your tr for next row.
HERE IS THE JSFIDDLE: http://jsfiddle.net/collabcoders/xSbyG/
Okay. I reworked it and tested it. This is the result I get:
First I add some css to clean the code and formatting.
<style>
.rightcolumn {
text-align:right;
height:25px;
text-overflow:ellipsis;
overflow: hidden;
white-space:nowrap;
font-weight:bold;
}
.leftcolumn {
text-align:left;
height:25px;
text-overflow:ellipsis;
overflow: hidden;
white-space:nowrap;
}
</style>
Then the ListView Template and Layout:
<asp:listview id="ListView1" runat="server" datasourceid="SqlDataSource1">
<ItemTemplate>
<table style="width:200px;">
<tr>
<td class="leftcolumn">
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="UsernameLabel" runat="server" Text='<%# Eval("Username") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="JobTitleLabel" runat="server" Text='<%# Eval("JobTitle") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="BadgeNumberLabel" runat="server" Text='<%# Eval("BadgeNumber") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="DivisionLabel" runat="server" Text='<%# Eval("DivisionName") %>' />
</td>
</tr>
<tr>
<td class="leftcolumn">
<asp:Label ID="RoleLabel" runat="server" Text='<%# Eval("RoleName") %>' />
</td>
</tr>
</table>
</ItemTemplate>
<LayoutTemplate>
<table id="outertable" border="1" runat="server">
<tr>
<td colspan="2" style="font-weight:bold;">
<center>Personal Information</center>
</td>
</tr>
<tr>
<td>
<table id="itemPlaceholderContainer" style="width:150px;" runat="server">
<tr>
<td class="rightcolumn">
Name
</td>
</tr>
<tr>
<td class="rightcolumn">
Username
</td>
</tr>
<tr>
<td class="rightcolumn">
Job Title
</td>
</tr>
<tr>
<td class="rightcolumn">
Badge Number
</td>
</tr>
<tr>
<td class="rightcolumn">
Division
</td>
</tr>
<tr>
<td class="rightcolumn">
Role
</td>
</tr>
</table>
</td>
<td id="itemPlaceholder" runat="server">
<!---List Item Template Goes Here--->
</td>
</tr>
<tr>
<td colspan="2">
<asp:DataPager ID="DataPager1" runat="server" PageSize="5">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:listview>

How can I relocate ListView

I have a ListView in the design view,,but I cant move it with an absolute css attribute.
Is there a way to move it on a page?
<asp:ListView ID="ListView1" runat="server" DataKeyNames="MessageID"
DataSourceID="SqlDataSource1" onitemcommand="ListView1_ItemCommand"
style="z-index: 1; left: 452px; top: 429px; position: absolute; height: 271px; width: 221px; margin-top: 0px">
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderContainer" runat="server" border="1"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr runat="server" style="background-color: #FFFBD6;color: #333333;">
<th runat="server">
MessageTitle</th>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server"
style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<AlternatingItemTemplate>
<tr style="background-color: #FAFAD2;color: #284775;">
<td>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select">'<%# Eval("MessageTitle") %>'</asp:LinkButton>
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<tr style="background-color: #FFCC66;color: #000080;">
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update"
Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Cancel" />
</td>
<td>
<asp:TextBox ID="MessageTitleTextBox" runat="server"
Text='<%# Bind("MessageTitle") %>' />
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table runat="server"
style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
<tr>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert"
Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel"
Text="Clear" />
</td>
<td>
<asp:TextBox ID="MessageTitleTextBox" runat="server"
Text='<%# Bind("MessageTitle") %>' />
</td>
<td>
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="background-color: #FFFBD6;color: #333333;">
<td>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select" >'<%# Eval("MessageTitle") %>'</asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<SelectedItemTemplate>
<tr style="background-color: #FFCC66;font-weight: bold;color: #000080;">
<td>
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Select">'<%# Eval("MessageTitle") %>'</asp:LinkButton>
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CP_AllQuestionsAnswered %>"
SelectCommand="GetMessagesTitles" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="Name" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
What a problem:
div.ListView1
{
position: absolute;
left: 100;
top: 100;
}
<asp:ListView runat="server" ID="ListView1" ItemPlaceholderID="itemPlaceholder">
<LayoutTemplate>
<div class="ListView1">
<asp:PlaceHolder runat="server" ID="itemPlaceholder" />
</div>
</LayoutTemplate>
<ItemTemplate>
<%# Container.DataItem.ToString() %>
<br />
</ItemTemplate>
</asp:ListView>
Ok, your problem is that you set ListView's style attribute when you need specify this attribute for the table in the LayoutTemplate.

Failing to move a listView with css

I am trying to move a list view with css...It moves to the left when i give it some value in the div tag in the layout template..but when I run it in the browser what I get is a listView sitting in the same place.. here is the code with the two problematic listviews:
<%# Page Title="" Language="C#" MasterPageFile="~/CP.master" AutoEventWireup="true"
CodeFile="Spam.aspx.cs" Inherits="Moderator_Spam" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<br />
<asp:Label ID="CommentHeader" runat="server" Text="הודעות ספאם של פוסטים"></asp:Label>
<br />
<br />
<asp:ListView ID="ListView1" runat="server" DataKeyNames="CommentsID" DataSourceID="SqlDataSource1"
Style="top: 433px; left: -56px">
<AlternatingItemTemplate>
<tr style="background-color: #FFF8DC;">
<td>
<asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>' />
</td>
<td>
<asp:Button ID="DeleteComment_Btn" runat="server" Text="מחק" CommandName="Delete" />
<asp:Button ID="IgnoreComment_Btn" runat="server" Text="התעלם" CommandName="Update" />
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<tr style="background-color: #008A8C; color: #FFFFFF;">
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
</td>
<td>
<asp:TextBox ID="CommentsTextBox" runat="server" Text='<%# Bind("Comments") %>' />
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table id="Table1" runat="server" style="background-color: #FFFFFF; border-collapse: collapse;
border-color: #999999; border-style: none; border-width: 1px;">
<tr>
<td>
אין ספאם
</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
</td>
<td>
<asp:TextBox ID="CommentsTextBox" runat="server" Text='<%# Bind("Comments") %>' />
</td>
<td>
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="background-color: #DCDCDC; color: #000000;">
<td>
<asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>' />
</td>
<td>
<asp:Button ID="DeleteComment_Btn" runat="server" Text="מחק" CommandName="Delete" />
<asp:Button ID="IgnoreComment_Btn" runat="server" Text="התעלם" CommandName="Update" />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<div style="position: absolute; left: 0px">
<table id="Table2" runat="server">
<tr id="Tr1" runat="server">
<td id="Td1" runat="server">
<table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;
border-collapse: collapse; border-color: #999999; border-style: none; border-width: 1px;
font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr id="Tr2" runat="server" style="background-color: #DCDCDC; color: #000000;">
<th id="Th1" runat="server">
Comments
</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr id="Tr3" runat="server">
<td id="Td2" runat="server" style="text-align: center; background-color: #CCCCCC;
font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</div>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="background-color: #008A8C; font-weight: bold; color: #FFFFFF;">
<td>
<asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>' />
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CP_AllQuestionsAnswered %>"
DeleteCommand="ModeratorSpamDeleteComment" DeleteCommandType="StoredProcedure"
SelectCommand="ModeratorSpamComments" SelectCommandType="StoredProcedure" UpdateCommand="ModeratorIgnoreSpamComment"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="CommentsID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="CommentsID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<br />
<asp:Label ID="Label1" runat="server" Text="הודעות ספאם של אשכולים"></asp:Label>
<br />
<asp:ListView ID="ListView2" runat="server" DataKeyNames="ThreadsID" DataSourceID="SqlDataSource2"
Style="z-index: 1; left: 452px; top: 753px; position: absolute; height: 381px;
width: 221px">
<AlternatingItemTemplate>
<tr style="background-color: #FFF8DC;">
<td>
<asp:Label ID="ThreadTitleLabel" runat="server" Text='<%# Eval("ThreadTitle") %>' />
</td>
<td>
<asp:Button ID="DeleteThread_Btn" runat="server" Text="מחק" CommandName="Delete" />
<asp:Button ID="IgnoreThread_Btn" runat="server" Text="התעלם" CommandName="Update" />
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<tr style="background-color: #008A8C; color: #FFFFFF;">
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
</td>
<td>
<asp:TextBox ID="ThreadTitleTextBox" runat="server" Text='<%# Eval("ThreadTitle") %>' />
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table id="Table3" runat="server" style="background-color: #FFFFFF; border-collapse: collapse;
border-color: #999999; border-style: none; border-width: 1px;">
<tr>
<td>
אין ספאם
</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
</td>
<td>
<asp:TextBox ID="ThreadTitleTextBox" runat="server" Text='<%# Bind("ThreadTitle") %>' />
</td>
<td>
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="background-color: #DCDCDC; color: #000000;">
<td>
<asp:Label ID="ThreadTitleLabel" runat="server" Text='<%# Eval("ThreadTitle") %>' />
</td>
<td>
<asp:Button ID="DeleteThread_Btn" runat="server" Text="מחק" CommandName="Delete" />
<asp:Button ID="IgnoreThread_Btn" runat="server" Text="התעלם" CommandName="Update" />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table id="Table4" runat="server">
<tr id="Tr4" runat="server">
<td id="Td3" runat="server">
<table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;
border-collapse: collapse; border-color: #999999; border-style: none; border-width: 1px;
font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr id="Tr5" runat="server" style="background-color: #DCDCDC; color: #000000;">
<th id="Th2" runat="server">
ThreadTitle
</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr id="Tr6" runat="server">
<td id="Td4" runat="server" style="text-align: center; background-color: #CCCCCC;
font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="background-color: #008A8C; font-weight: bold; color: #FFFFFF;">
<td>
<asp:Label ID="ThreadTitleLabel" runat="server" Text='<%# Eval("ThreadTitle") %>' />
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:CP_AllQuestionsAnswered %>"
DeleteCommand="ModeratorSpamDeleteThread" DeleteCommandType="StoredProcedure"
SelectCommand="ModeratorSpamThread" SelectCommandType="StoredProcedure" UpdateCommand="ModeratorSpamIgnoreThread"
UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="ThreadsID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ThreadsID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>
I suppose your error is that you try to set Style on a ListView control directly. The listView control hasn't Style property. Actually there is element this style may be applied on. Move styles from ListViews to the first table in LayoutTemplate.
Put the list view inside a div and give it a margin-left
<asp:ListView ID="ListView1" runat="server" DataKeyNames="CommentsID" DataSourceID="SqlDataSource1"
Style="top: 433px; left: -56px">
<AlternatingItemTemplate>
<tr style="background-color: #FFF8DC;">
<td>
<asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>' />
</td>
<td>
<asp:Button ID="DeleteComment_Btn" runat="server" Text="מחק" CommandName="Delete" />
<asp:Button ID="IgnoreComment_Btn" runat="server" Text="התעלם" CommandName="Update" />
</td>
</tr>
</AlternatingItemTemplate>
<EditItemTemplate>
<tr style="background-color: #008A8C; color: #FFFFFF;">
<td>
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
</td>
<td>
<asp:TextBox ID="CommentsTextBox" runat="server" Text='<%# Bind("Comments") %>' />
</td>
</tr>
</EditItemTemplate>
<EmptyDataTemplate>
<table id="Table1" runat="server" style="background-color: #FFFFFF; border-collapse: collapse;
border-color: #999999; border-style: none; border-width: 1px;">
<tr>
<td>
אין ספאם
</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
</td>
<td>
<asp:TextBox ID="CommentsTextBox" runat="server" Text='<%# Bind("Comments") %>' />
</td>
<td>
</td>
</tr>
</InsertItemTemplate>
<ItemTemplate>
<tr style="background-color: #DCDCDC; color: #000000;">
<td>
<asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>' />
</td>
<td>
<asp:Button ID="DeleteComment_Btn" runat="server" Text="מחק" CommandName="Delete" />
<asp:Button ID="IgnoreComment_Btn" runat="server" Text="התעלם" CommandName="Update" />
</td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<div style="position: absolute; left: 0px">
<table id="Table2" runat="server">
<tr id="Tr1" runat="server">
<td id="Td1" runat="server">
<table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;
border-collapse: collapse; border-color: #999999; border-style: none; border-width: 1px;
font-family: Verdana, Arial, Helvetica, sans-serif;">
<tr id="Tr2" runat="server" style="background-color: #DCDCDC; color: #000000;">
<th id="Th1" runat="server">
Comments
</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr id="Tr3" runat="server">
<td id="Td2" runat="server" style="text-align: center; background-color: #CCCCCC;
font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000;">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</div>
</LayoutTemplate>
<SelectedItemTemplate>
<tr style="background-color: #008A8C; font-weight: bold; color: #FFFFFF;">
<td>
<asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>' />
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
</div>

Resources