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>
Related
I have a FormView and a ListView that I would like to live only inside the FormView's EditITemTemplate. However, any time I click an Edit or Update LinkButton in the ListView (with the FOrmView in Edit Mode) the page errors with: "Cannot have multiple items selected in a DropDownList." As you can see below, I have removed the ListView from the FormView completely, and the ListView functions as intended if the FormView is in ReadOnly.
<asp:SqlDataSource ID="SqlSource" runat="server" ConnectionString="<%$ ConnectionStrings:RTUConnectionString %>"
SelectCommand="SELECT *, '' LogInput FROM [nei_list] WHERE [nei_id]=#ID">
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="ID" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlNEIT" runat="server" ConnectionString="<%$ ConnectionStrings:RTUConnectionString %>"
SelectCommand="SELECT ID TID, CLLI, EquipmentType, Officecode, OfficeName, WorkingLines, Testable Tstbl FROM NEI_Testable WHERE CLLI=#ID ORDER BY [EquipmentType], OfficeCode"
UpdateCommand="UPDATE NEI_Testable SET Testable = #Tstbl WHERE ID=#TID"
>
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="ID" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Tstbl" Type="String" />
<asp:Parameter Name="TID" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlSource" DefaultMode="ReadOnly">
<EditItemTemplate>
<table cellpadding="6" style="width: 100%">
<tr style="font-size:large; background-color: #006600; color: #FFFFFF;">
<td style="padding: 2px" align="center"></b></td>
<td style="padding: 2px" colspan="5" align="left"><b>NEI Maintenance and Inventory Log</b></td></tr>
<tr>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>Location ID:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Textbox ID="txtLocID" runat="server" Text='<%# Bind("Location_ID") %>' /></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>Location Name:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Textbox ID="txtLocName" runat="server" Text='<%# Bind("LOCATION_NAME") %>' /></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>NET_LOC_TYPE_ID:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Textbox ID="txtNETLOC" runat="server" Text='<%# Bind("NET_LOC_TYPE_ID") %>' /></td>
</tr>
<tr>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>Host:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Textbox ID="txtHOST" runat="server" Text='<%# Bind("MAIN_ID") %>' /></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>EXCH AREA CLLI:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Textbox ID="txtEXCH" runat="server" Text='<%# Bind("EXCHANGE_AREA_CLLI") %>' /></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>OP CO NUM:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Textbox ID="txtOPCO" runat="server" Text='<%# Bind("OPERATING_COMPANY_NUMBER") %>' /></td>
</tr>
<tr>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B></B></td>
<td style="font-size:small; background-color:#E8E8E8; color: #333333; width: 130px;"><B>System:</B></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>Testable:</B></td>
<td style="font-size:small; background-color:#E8E8E8; color: #333333; width: 130px;"><B>RTU:</B></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>EXT:</B></td>
<td style="font-size:small; background-color:#E8E8E8; color: #333333; width: 130px;"><B>NEI:</B></td>
</tr>
<tr>
<td style="font-size:medium; background-color: #CEF6CE;color: #284775; "></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; ">
<asp:DropDownList ID="ddlSys" runat="server" SelectedValue='<%# Bind("system") %>' Enabled="True" >
<asp:ListItem Value="AC" Selected="True">AC</asp:ListItem>
<asp:ListItem Value="OSG" Selected="True">OSG</asp:ListItem>
</asp:DropDownList>
</td>
<td style="font-size:medium; background-color: #CEF6CE;color: #284775; ">
<asp:DropDownList ID="ddlTst" runat="server" SelectedValue='<%# Bind("testable") %>' Enabled="True" >
<asp:ListItem Value="YES" Selected="True">YES</asp:ListItem>
<asp:ListItem Value="NO" Selected="True">NO</asp:ListItem>
</asp:DropDownList>
</td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; ">
<asp:DropDownList ID="ddlRTU" runat="server" SelectedValue='<%# Bind("RTU") %>' Enabled="True" >
<asp:ListItem Value="YES" Selected="True">YES</asp:ListItem>
<asp:ListItem Value="NO" Selected="True">NO</asp:ListItem>
</asp:DropDownList>
</td>
<td style="font-size:medium; background-color: #CEF6CE;color: #284775; ">
<asp:DropDownList ID="ddlEXT" runat="server" SelectedValue='<%# Bind("EXT") %>' Enabled="True" >
<asp:ListItem Value="YES" Selected="True">YES</asp:ListItem>
<asp:ListItem Value="NO" Selected="True">NO</asp:ListItem>
</asp:DropDownList>
</td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; ">
<asp:DropDownList ID="ddlNEI" runat="server" SelectedValue='<%# Bind("NEI") %>' Enabled="True" >
<asp:ListItem Value="YES" Selected="True">YES</asp:ListItem>
<asp:ListItem Value="NO" Selected="True">NO</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; text-align:center"><B>*<%#Request.Cookies["RTUA"]["NAME"].ToString() %>*<br />*<%#DateTime.Now.ToString("MM-dd-yyyy h:mmtt") %>*</B></td>
<td colspan="5" style="font-size:medium; background-color: #E8E8E8;color: #284775;"><asp:Textbox ID="txtREMARKS" runat="server" Text='<%# Bind("LogInput") %>' Rows="5" TextMode="MultiLine" Width="100%" /></td>
</tr>
<tr style="font-size:large; background-color: #006600; color: #FFFFFF;">
<td style="padding: 2px" align="center"><b><asp:button id="UpdateButton" CausesValidation="True" text="Update" commandname="Update" runat="server" ForeColor="#003300"/> </b></td>
<td style="padding: 2px" colspan="5" align="left"><b></b></td></tr>
<tr>
</tr>
</table>
</EditItemTemplate>
<ItemTemplate>
<table cellpadding="6" style="width: 100%">
<tr style="font-size:large; background-color: #006600; color: #FFFFFF;">
<td style="padding: 2px" align="center"><b><asp:button id="EditButton" text="EDIT" commandname="Edit" runat="server" ForeColor="#003300"/> </b></td>
<td style="padding: 2px" colspan="5" align="left"><b>NEI Maintenance and Inventory Log</b></td></tr>
<tr>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>Location ID:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Label ID="lblLocID" runat="server" Text='<%# Bind("Location_ID") %>' /></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>Location Name:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Label ID="lblLocName" runat="server" Text='<%# Bind("LOCATION_NAME") %>' /></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>NET_LOC_TYPE_ID:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Textbox ID="lblNETLOC" runat="server" Text='<%# Bind("NET_LOC_TYPE_ID") %>' /></td>
</tr>
<tr>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>Host:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Label ID="lblHOST" runat="server" Text='<%# Bind("MAIN_ID") %>' /></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>EXCH AREA CLLI:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Label ID="lblEXCH" runat="server" Text='<%# Bind("EXCHANGE_AREA_CLLI") %>' /></td>
<td style="font-size:small; background-color:#CEF6CE; color: #333333; width: 130px;"><B>OP CO NUM:</B></td>
<td style="font-size:medium; background-color: #E8E8E8;color: #284775; "><asp:Label ID="lblOPCO" runat="server" Text='<%# Bind("OPERATING_COMPANY_NUMBER") %>' /></td>
</tr>
</Table>
</ItemTemplate>
</asp:FormView>
<asp:ListView ID="lvNEIT" runat="server" DataSourceID="SqlNEIT">
<ItemTemplate>
<tr style="font-size:small; background-color: #FFFFFF;color: #284775;">
<td></td>
<td align="center">
<asp:Label ID="lblNEIID" runat="server" Text='<%# Bind("TID") %>' Visible="false" />
<asp:Label ID="lblNEIEQT" runat="server" Text='<%# Eval("EquipmentType") %>' />
</td>
<td align="center">
<asp:Label ID="lblNEION" runat="server" Text='<%# Eval("OfficeName") %>' />
</td>
<td align="center">
<asp:Label ID="lblNEIOC" runat="server" Text='<%# Eval("OfficeCode") %>' />
</td>
<td align="center">
<asp:Label ID="lblNEIWL" runat="server" Text='<%# Eval("WorkingLines") %>' />
</td>
<td align="right">
<asp:DropDownList ID="ddlNEITST" runat="server" SelectedValue='<%# Bind("Tstbl") %>' Enabled="False" >
<asp:ListItem Value="YES" Selected="True">YES</asp:ListItem>
<asp:ListItem Value="NO" Selected="True">NO</asp:ListItem>
<asp:ListItem Value="UNK" Selected="True">UNK</asp:ListItem>
</asp:DropDownList>
<asp:LinkButton ID="btnNEIEdit" runat="server" Text="Edit" CommandName="Edit" />
</td>
</tr>
</ItemTemplate>
<EditItemTemplate>
<tr style="font-size:small; background-color: #FFFFFF;color: #284775;">
<td></td>
<td align="center">
<asp:Label ID="lblNEIID" runat="server" Text='<%# Bind("TID") %>' Visible="false" />
<asp:Label ID="lblNEIEQT" runat="server" Text='<%# Bind("EquipmentType") %>' />
</td>
<td align="center">
<asp:Label ID="lblNEION" runat="server" Text='<%# Bind("OfficeName") %>' />
</td>
<td align="center">
<asp:Label ID="lblNEIOC" runat="server" Text='<%# Bind("OfficeCode") %>' />
</td>
<td align="center">
<asp:Label ID="lblNEIWL" runat="server" Text='<%# Bind("WorkingLines") %>' />
</td>
<td align="right">
<asp:DropDownList ID="ddlNEITST" runat="server" SelectedValue='<%# Bind("Tstbl") %>' Enabled="True" >
<asp:ListItem Value="YES" Selected="True">YES</asp:ListItem>
<asp:ListItem Value="NO" Selected="True">NO</asp:ListItem>
<asp:ListItem Value="UNK" Selected="True">UNK</asp:ListItem>
</asp:DropDownList>
<asp:LinkButton ID="btnNEISave" runat="server" Text="Update" CommandName="Update" />
</td>
</tr>
</EditItemTemplate>
<LayoutTemplate>
<table width="98%" cellpadding="5" cellspacing="3" runat="server">
<tr align="center" 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></tr>
<tr runat="server" style="font-size:small; background-color:#006600; color: #FFFFFF;">
<th runat="server"></th>
<th runat="server">EquipmentType</th>
<th runat="server">OfficeName</th>
<th runat="server">OfficeCode</th>
<th runat="server">WorkingLines</th>
<th runat="server">Testable</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
Thanks in advance
you should use ListBox control instead of dropdownlist
<asp:ListBox runat="server" ID="ddlSys" SelectionMode="multiple">
<asp:ListItem Value="AC" Selected="True">AC</asp:ListItem>
<asp:ListItem Value="OSG" Selected="True">OSG</asp:ListItem>
</asp:ListBox>
Every single one of my ListItem's contained Selected="True". Removed that and everything works perfectly.
Seems like that silly mistake would have caused the page to fail on the very first binding event, rather than only happening when both the FormView and ListView were in edit mode.
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>
I've been having this odd issue with modal popups. For some reason when I choose a dropdown item my update button wont fire a click event. but then I leave the dropdown at their default values the update button works just fine.
here's my aspx page code
<asp:Button ID="Button1" CssClass="hide" runat="server" Text="Button" />
<ajaxToolkit:ModalPopupExtender runat="server" ID="cfPopUp" PopupControlID="Panel4"
TargetControlID="Button1" OkControlID="cfUpdateBtn" CancelControlID="cfCancelBtn" />
<asp:Panel ID="Panel4" runat="server" CssClass="modalPopup">
<asp:UpdatePanel ID="UpdatePanel2" runat="Server">
<ContentTemplate>
<asp:Panel ID="Panel13" CssClass="" runat="server">
<asp:Panel ID="Panel14" CssClass="" runat="server">
<div style="padding: 10px; border: 3px solid black; background-color: White; color: Black;">
<asp:Label ID="Label25" Width="200px" runat="server" Text="Health and Safety Net" /><div
class="seperator">
</div>
<table class="style143">
<tr>
<td class="style185">
<asp:Label ID="cfCategorylbl" runat="server" Text="Category:"></asp:Label>:
</td>
<td>
<asp:DropDownList ID="cbFactors_Categories" runat="server" Width="350px" Font-Names="Tahoma"
Font-Size="Small" ForeColor="DimGray" Height="24px" CssClass="style75">
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="CascadingDropDown3" runat="server" TargetControlID="cbFactors_Categories"
Category="categories" ServiceMethod="getCategory" ServicePath="~/2012/IrSubmitWebService.asmx"
PromptText="Select Category" />
</td>
<td align="center" rowspan="3" valign="top">
<asp:Label ID="lblFactor_ID" runat="server" Font-Names="Tahoma" Font-Size="Small"
ForeColor="DimGray" Style="font-style: italic" TabIndex="56"></asp:Label>
<cc1:DynamicPopulateExtender ID="lblFactor_ID_DynamicPopulateExtender" runat="server"
Enabled="True" TargetControlID="lblFactor_ID" BehaviorID="dp1" ServiceMethod="getFactorID"
ServicePath="~/2012/IrSubmitWebService.asmx">
</cc1:DynamicPopulateExtender>
<hr class="style157" />
<asp:Label ID="cfID" runat="server" Font-Names="Tahoma" Font-Size="Small" ForeColor="DimGray"
Style="font-style: italic" Width="400px" TabIndex="57"></asp:Label>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label ID="cfTypeslbl" runat="server" Text="Type:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="cbFactors_Types" runat="server" ForeColor="DimGray" Height="24px"
TabIndex="54" Width="350px" Font-Names="Tahoma" Font-Size="Small" CssClass="style75">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cbFactors_Types_CascadingDropDown" runat="server"
TargetControlID="cbFactors_Types" ParentControlID="cbFactors_Categories" Category="type"
ServiceMethod="getTypeofAction" ServicePath="~/2012/IrSubmitWebService.asmx"
PromptText="Select Type">
</cc1:CascadingDropDown>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label ID="cfFactorslbl" runat="server" Text="Factor:"></asp:Label>
</td>
<td>
<asp:DropDownList ID="cbFactors_Factors" runat="server" ForeColor="DimGray" Height="24px"
TabIndex="55" Width="350px" Font-Names="tahoma" Font-Size="Small" CssClass="style75">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cbFactors_Factors_CascadingDropDown" runat="server"
TargetControlID="cbFactors_Factors" ParentControlID="cbFactors_Types" Category="category"
ServiceMethod="getFactor" ServicePath="~/2012/IrSubmitWebService.asmx" PromptText="Select Factor">
</cc1:CascadingDropDown>
</td>
</tr>
<tr>
<td class="style185">
<asp:Label Text="Justification:" ID="cfJustificationlbl" runat="server"></asp:Label>
</td>
<td colspan="2">
<asp:TextBox ID="txtJustification" runat="server" ForeColor="DimGray" Height="29px"
Style="font-family: Tahoma; font-size: small" TabIndex="56" TextMode="MultiLine"
ToolTip="Provide a justification for this factor." Width="775px" Font-Names="Tahoma"
Font-Size="Small"></asp:TextBox>
</td>
</tr>
</table>
<br />
<div style="text-align: center">
<asp:Button CausesValidation="false" ID="cfUpdateBtn" runat="server"
Text="Update" CssClass="button" /><span style="margin-left: 10px"><asp:Button CausesValidation="false"
ID="cfCancelBtn" runat="server" Text="Cancel" CssClass="button" /></span></div>
</div>
</asp:Panel>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
and my code behind for my update (it just closes the popup)
Protected Sub cfUpdateBtn_Click(sender As Object, e As EventArgs) Handles cfUpdateBtn.Click
cfPopUp.Hide()
End Sub
For the life of me I can't figure out why the update button wont work when the dropdowns are not the default value.
Thanks for your help guys
The possible reason may be you are binding your dropdownlist with a webservice. Whenever you click to an item on dropdownlist webservice may be called. If webservice is called then may be your page again loaded ? I don't know the exact reason why it is not working. You have to check the service behavior what happened when the service is called.
I basically rebuilt my modal popup and update panel like so
<asp:Panel ID="pnlEditPopup" runat="server" CssClass="modalPopup">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlEditPopupContent" runat="server">
<div style="padding: 10px; border: 3px solid black; background-color: White; color: Black;">
<table cellpadding="0" cellspacing="4" border="0">
<tr>
<td class="name">Category:</td>
<td class="value">
<asp:DropDownList id="ddCat" runat="server">
<asp:listitem value="">No Selection</asp:listitem>
<asp:listitem value="Action">Action</asp:listitem>
<asp:listitem value="Worksite">Worksite</asp:listitem>
<asp:listitem value="Human Factors">Human Factors</asp:listitem>
<asp:listitem value="System Factors">System Factors</asp:listitem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="name">Type:</td>
<td class="value">
<asp:DropDownList id="ddType" runat="server" />
<ajaxToolkit:CascadingDropDown ID="ccType" runat="server"
TargetControlID="ddType"
ParentControlID="ddCat"
PromptText="No Selection"
LoadingText="Please Wait..."
ServicePath="~/2012/IrSubmitWebService.asmx"
ServiceMethod="getTypeofAction"
Category="Other"
/>
</td>
</tr>
<tr>
<td class="name">Factor:</td>
<td class="value">
<asp:DropDownList id="ddfactor" runat="server" />
<ajaxToolkit:CascadingDropDown ID="ccFactor" runat="server"
TargetControlID="ddfactor"
ParentControlID="ddType"
PromptText="No Selection"
LoadingText="Please Wait..."
ServicePath="~/2012/IrSubmitWebService.asmx"
ServiceMethod="getFactor"
Category="Other"
/>
</td>
</tr>
<tr>
<td>
Justification:
<asp:Label ID="factorID" runat="server" Visible="false"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtJustification" runat="server" ForeColor="DimGray" Height="100px"
Style="font-family: Tahoma; font-size: small" TabIndex="56" TextMode="MultiLine"
ToolTip="Provide a justification for this factor." Width="300px" Font-Names="Tahoma"
Font-Size="Small"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Factor ID<br />
and Description:
</td>
<td>
<asp:Label ID="factor_id_Desc" runat="server" Width="300px" Font-Names="Tahoma" Font-Size="Small"
ForeColor="DimGray" TabIndex="56"></asp:Label>
<cc1:DynamicPopulateExtender ID="DynamicPopulateExtender1" runat="server"
Enabled="True" TargetControlID="factor_id_Desc" BehaviorID="dp1" ServiceMethod="getFactorID"
ServicePath="~/2012/IrSubmitWebService.asmx">
</cc1:DynamicPopulateExtender>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="btnOkEditPopup" runat="server" Text="Ok" CssClass="button"/>
<span style="margin-left:10px"><asp:button id="btnCancelEditPopup" runat="server" text="Cancel" CssClass="button"/></span>
</td>
</tr>
</table>
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<ajaxToolkit:ModalPopupExtender ID="mpeEdit" runat="server"
TargetControlID="btnOpenEditPopup"
PopupControlID="pnlEditPopup"
/>
Fixed my issue. I still dont know why it wasn't working when I asked the question but I was able to solve it. Thanks to all who looked into it for me.
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.
everyone!
I'm writing repeater control on my web-page. After I added data paging for repeater I have got problem:
ImageButton does'nt fire any more OnItemCommand event of repeater. Why?
Here, is part of markup code:
<asp:Repeater ID="PartsRepeater" runat="server"
OnItemCommand="partsRepeater_ItemCommand"
OnItemDataBound="partsRepeaterItem_Bound">
<HeaderTemplate>
<table rules="all" cellspacing="0" style="border-color: rgb(31, 77, 48);
border-style: solid; width: 100%; border-collapse: collapse;">
<tr >
<td style="width: 92%;">
<table cellspacing="0" border="0" style="border-color: rgb(31, 77, 48); border-style: solid;
width: 100%; border-collapse: collapse;">
<tr style="background-color: #1f4d30; color: white;">
<td style="width: 10%;">
<asp:Label runat="server" Text="Name" ID="lblName">
</asp:Label>
</td>
<td style="width: 10%;">
<asp:Label runat="server" Text="Number" ID="Label64">
</asp:Label>
</td>
<td style="width: 10%;">
<asp:Label runat="server" Text="Category" ID="Label65">
</asp:Label>
</td>
<td style="width: 20%;">
<asp:Label runat="server" Text="Description" ID="Label66">
</asp:Label>
</td>
<td style="width: 20%;">
<asp:Label runat="server" Text="Models" ID="Label67">
</asp:Label>
</td>
<td style="width: 5%;">
<asp:Label runat="server" Text="Price" ID="Label68">
</asp:Label>
</td>
<td style="width: 5%;">
<asp:Label runat="server" Text="A Qty" ID="Label69">
</asp:Label>
</td>
<td style="width: 5%;">
<asp:Label runat="server" Text="B Qty" ID="Label70">
</asp:Label>
</td>
<td style="width: 5%;">
<asp:Label runat="server" Text="Actual Qty" ID="Label71">
</asp:Label>
</td>
<td style="width: 5%;">
<asp:Label runat="server" Text="Total Qty" ID="Label72">
</asp:Label>
</td>
<td style="width: 5%;" >
</td>
</tr>
</table>
</td>
<td style="width: 8%;" >
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="border-color: #1f4d30;"
>
<td style="width: 92%;">
<table border="0" cellspacing="0" class="PartsRepeater_InnerTable">
<tr class="PartsRepeater_InnerTable">
<td style="cursor: pointer; width: 10%;" class="PartsRepeater_InnerTable">
<asp:HiddenField runat="server" ID="PartID" Value='<%# Bind("PartID") %>' Visible="false" />
<asp:LinkButton runat="server" ID="Label52" Text='<%#Eval("Name").ToString()%>' CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 10%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="Label45" runat="server" Text='<%#Eval("Number").ToString().ToUpper()%>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 20%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="Label46" runat="server" Text='<%#Eval("Category").ToString()%>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 20%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="Label47" runat="server" Text='<%# GetPartDescr((String)Eval("Description"))%>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 5%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="Label48" runat="server" Text=' <%# GetPartDescr((String)Eval("ModelName")) %>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 4%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="Label49" runat="server" Text='<%# GetPrice(Eval("Price").ToString(), Eval("sPrice").ToString(), Eval("Price3").ToString())%>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 4%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="lblAQTY" runat="server" Text=' <%#Eval("AGradeQty").ToString()%>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 4%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="lblBQty" runat="server" Text=' <%# int.Parse(Eval("QtyInStock").ToString()) - int.Parse(Eval("AGradeQty").ToString())%>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 4%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="lblActualQTY" runat="server" Text=' <%#Eval("ActualQty").ToString()%>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 4%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="Label60" runat="server" Text='<%#Eval("QtyInStock").ToString()%>'
CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
</tr>
<tr >
<td colspan="15" style="cursor: pointer; width: 5%;">
<asp:LinkButton ID="Label63" runat="server" Text='<%#Eval("priceModificationDate").ToString()%>'
Font-Size="Smaller" CommandArgument='<%# Eval("PartID") %>'>
</asp:LinkButton>
</td>
</tr>
</table>
</td>
<td style="width: 8%">
<table>
<tr>
<td style="cursor: pointer; width: 50%;" class="PartsRepeater_InnerTable">
<asp:ImageButton ID="btnEdit" runat="server" ImageUrl="~/Images/edit.png" CausesValidation="False"
CommandName="editRow" CommandArgument='<%# Eval("PartID") %>' OnClientClick='SaveScrollPositions'>
</asp:ImageButton>
</td>
<td style="cursor: pointer; width: 50%;">
<asp:ImageButton ID="btnDelete" runat="server" OnClientClick='<%# GetConfirmMessage(Eval("Name"))%>'
ImageUrl="~/Images/delete.png" CausesValidation="False" CommandName="Delete"
CommandArgument='<%# Eval("PartID") %>'></asp:ImageButton>
</td>
</tr>
</table>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
I've tried nany ways to solve this problem and solved it so:
I just replace ImageButton with linkButton with image:
Part og code:
<td style="cursor: pointer; width: 50%;" class="PartsRepeater_InnerTable">
<asp:LinkButton ID="btnEdit" runat="server" CausesValidation="false" CommandName="editRow"
CommandArgument='<%# Eval("PartID") %>' OnClientClick='SaveScrollPositions'>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/edit.png" />
</asp:LinkButton>
</td>
<td style="cursor: pointer; width: 50%;">
<asp:LinkButton ID="btnDelete" runat="server" CausesValidation="false" CommandName="Delete"
CommandArgument='<%# Eval("PartID") %>' OnClientClick='<%# GetConfirmMessage(Eval("Name"))%>'>
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/delete.png" />
</asp:LinkButton>
</td>
For more see: http://weblogs.asp.net/justinsaraceno/archive/2008/11/05/linkbutton-with-image-and-text.aspx
Sorry I don't have a more specific answer, but it has something to do with ViewState on the repeater and rebinding the repeater on Postback.
Apparently, when the postback occurs and you rebind the repeater, it loses some event binding and instead of running the OnCommand, it treats it as if it's a first page load for ImageButton. AFAIK it only happens on ImageButton and not LinkButton or Button.
Put this in code behind it will surely work
if (!Page.IsPostBack)
{
REPEATERDATABIND(); // Bind method
}