Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET Ajax ListView
actually i have below listview at my user control page:
<asp:ListView ID="lv_Uc_Module" runat="server"
            onitemediting="lv_Uc_Module_ItemEditing" 
            onitemupdating="lv_Uc_Module_ItemUpdating" 
            onitemcanceling="lv_Uc_Module_ItemCanceling" 
            onitemdeleting="lv_Uc_Module_ItemDeleting"  
            OnItemDataBound="lv_Uc_Module_ItemDataBound"
            InsertItemPosition="LastItem"
            OnSorting="lv_Uc_Module_Sorting" 
            oniteminserting="lv_Uc_Module_ItemInserting" 
            DataKeyNames="EmpID">
 
                <LayoutTemplate>
                    <table id="table_Lv_Layout"  runat="server">
                        <tr id="tr_Table_Layout"  runat="server">
                            <td id="td_Table_Layout"  runat="server">
                                <table ID="itemPlaceholderContainer"  runat="server" class="th_ItemTemplate">
                                    <tr id="tr_Table_IphContainer"  runat="server" style="">
                                        <th id="th1_Table_IphContainer"  runat="server">
                                            <asp:Label ID="lb1_Table_IphContainer" runat="server" Text=""></asp:Label>
                                            <asp:ImageButton ID="imb1_Table_IphContainer" CommandArgument="EmpID" CommandName="Sort" ImageUrl="~/Images/asc.png" runat="server" />
                                        </th>
                                        <th id="th2_Table_IphContainer"  runat="server">
                                            <asp:Label ID="lb2_Table_IphContainer" runat="server" Text=""></asp:Label>
                                            <asp:ImageButton ID="imb2_Table_IphContainer" CommandArgument="EmpName" CommandName="Sort" ImageUrl="~/Images/asc.png" runat="server" />
                                        </th>
                                        <th id="th3_Table_IphContainer"  runat="server">
                                            <asp:Label ID="lb3_Table_IphContainer" runat="server" Text=""></asp:Label>
                                        </th>
                                        <th id="th4_Table_IphContainer"  runat="server">
                                            <asp:Label ID="lb4_Table_IphContainer" runat="server" Text=""></asp:Label>
                                        </th>
                                        <th id="th5_Table_IphContainer"  runat="server">
                                            <asp:Label ID="lb5_Table_IphContainer" runat="server" Text=""></asp:Label>
                                        </th>
                                        <th id="th6_Table_IphContainer"  runat="server">
                                            
                                        </th>
                                    </tr>
                                    <tr ID="itemPlaceholder"  runat="server">
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr id="tr_Validate_Table_Layout"  runat="server">
                            <td id="td_Validate_Table_Layout"  runat="server" style="text-align: center;background-color: #CCCCCC;">
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" HeaderText="You received the following errors:" ShowMessageBox="true" ShowSummary="false" ValidationGroup="VGEditTmp" />
                                <asp:ValidationSummary ID="ValidationSummary2" runat="server" HeaderText="You received the following errors:" ShowMessageBox="true" ShowSummary="false" ValidationGroup="VGInsertTmp" />
                            </td>
                        </tr>
                    </table>
                    <br />
                    <asp:DataPager ID="lv_DataPager" runat="server" PagedControlID="lv_Uc_Module" PageSize="5" OnPreRender="lv_DataPager_PreRender">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="true" ShowLastPageButton="true" />
                            <asp:TemplatePagerField>
                                <PagerTemplate>
                                    <span style="color:Maroon;">Records:
                                        <%# Container.StartRowIndex >= 0 ? (Container.StartRowIndex + 1) : 0 %>
                                        -
                                        <%# (Container.StartRowIndex + Container.PageSize) > Container.TotalRowCount ? Container.TotalRowCount : (Container.StartRowIndex + Container.PageSize)%>
                                        of
                                        <%# Container.TotalRowCount %>
                                        <span style="color:Red;">
                                        OR  
                                        </span>
                                        <span style="color: Blue;">
                                        Page 
                                        <%# Container.TotalRowCount>0 ? (Container.StartRowIndex / Container.PageSize) + 1 : 0 %>
                                        of
                                        <%# Math.Ceiling((double)Container.TotalRowCount / Container.PageSize) %>
                                        </span>
                                    </span>
                                </PagerTemplate>
                            </asp:TemplatePagerField>
                        </Fields>
                    </asp:DataPager>
                </LayoutTemplate>
 
                <ItemTemplate>
                    <tr class="tr_ItemTemplate">
                        <td>
                            <asp:Label ID="lb_ItemTemp1" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:Label ID="lb_ItemTemp2" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:Label ID="lb_ItemTemp3" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:Label ID="lb_ItemTemp4" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:Label ID="lb_ItemTemp5" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:Button ID="btn_Edit" runat="server" CommandName="Edit" Text="" CssClass="btn_Edit" CausesValidation="True" />
                            <asp:Button ID="btn_Delete" runat="server" CommandName="Delete" Text="" CssClass="btn_Delete" CausesValidation="false" OnClientClick="return confirm('Are you sure you want to delete this item?');" />
                        </td>
                    </tr>
                </ItemTemplate>
 
                <EditItemTemplate>
                    <tr style="background-color:#008A8C;color: #FFFFFF;">
                        <td>
                            <asp:Label ID="lb_ItemTemp1" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:TextBox ID="td_EditTemp1" runat="server" Text='' ValidationGroup="VGEditTmp" />
                            <asp:RequiredFieldValidator runat="server" ID="RequiredName" ControlToValidate="td_EditTemp1" ErrorMessage="Name is required" ValidationGroup="VGEditTmp" Display="None" ></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="regName" runat="server" ControlToValidate="td_EditTemp1" ValidationExpression="^[a-zA-Z'.\s]{1,50}" ErrorMessage="Enter a valid Name" ValidationGroup="VGEditTmp" Display="None"></asp:RegularExpressionValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="td_EditTemp2" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:TextBox ID="td_EditTemp3" runat="server" Text='' ValidationGroup="VGEditTmp" />
                            <asp:RangeValidator ID="ValidateAge" runat="server" ControlToValidate="td_EditTemp3" MinimumValue="18" MaximumValue="50" Type="Integer" ErrorMessage="Age should be within the valid interval(18-50)!" ValidationGroup="VGEditTmp" SetFocusOnError="true" Display="None"></asp:RangeValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="td_EditTemp4" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:Button ID="btn_Update" runat="server" CommandName="Update" Text="Update" ValidationGroup="VGEditTmp" />
                            <asp:Button ID="btn_Cancel" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
                        </td>
                    </tr>
                </EditItemTemplate>
 
                <InsertItemTemplate>
                    <tr style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
                        <td>
                             
                        </td>
                        <td>
                            <asp:TextBox ID="td_EditTemp1" runat="server" Text='' ValidationGroup="VGInsertTmp" />
                            <asp:RequiredFieldValidator runat="server" ID="RequiredName" ControlToValidate="td_EditTemp1" ErrorMessage="Name is required" ValidationGroup="VGInsertTmp" Display="None"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="regName" runat="server" ControlToValidate="td_EditTemp1" ValidationExpression="^[a-zA-Z'.\s]{1,50}" ErrorMessage="Enter a valid Name" ValidationGroup="VGInsertTmp" Display="None"></asp:RegularExpressionValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="td_EditTemp2" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:TextBox ID="td_EditTemp3" runat="server" Text='' ValidationGroup="VGInsertTmp" />
                            <asp:RangeValidator ID="ValidateAge" runat="server" ControlToValidate="td_EditTemp3" MinimumValue="18" MaximumValue="50" Type="Integer" ErrorMessage="Age should be within the valid interval(18-50)!" ValidationGroup="VGInsertTmp" SetFocusOnError="true" Display="None"></asp:RangeValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="td_EditTemp4" runat="server" Text='' />
                        </td>
                        <td>
                            <asp:Button ID="btn_Insert" runat="server" CommandName="Insert" Text="Insert" ValidationGroup="VGInsertTmp" />
                            <asp:Button ID="btn_Cancel" runat="server" CommandName="Cancel" Text="Clear" CausesValidation="false" />
                        </td>
                    </tr>
                </InsertItemTemplate>
 
            </asp:ListView>
 
and i want to replace the insert part to above the table.
could you please guide me how to overcome this problem. i'm using asp.net and c#. Appreciate your consideration.
Posted 8-Jan-12 20:50pm
Far sh483

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 6,212
1 OriginalGriff 5,498
2 CPallini 2,473
3 Richard MacCutchan 1,627
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 9 Jan 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100