Link to home
Start Free TrialLog in
Avatar of doramail05
doramail05Flag for Malaysia

asked on

gridview's last 2 columns shift right after merged cells

after merching cells like below:

e.Row.Cells.RemoveAt(2);
e.Row.Cells.RemoveAt(3);
e.Row.Cells.RemoveAt(4);
e.Row.Cells[1].ColumnSpan = 4;

notice that the 2nd last column shift to last column as displayed in attach pic
the imagebutton supposed to be in 2nd last column
User generated image
</asp:GridView>
                 <asp:GridView ID="gvClaimSummary"  HeaderStyle-BackColor="#B8A9DC"
                  AlternatingRowStyle-BackColor="#E4E0EE" HeaderStyle-ForeColor="White" 
                         BorderColor="Black" BorderWidth="1px" Width="1100px"
                         RowStyle-VerticalAlign="Top" AllowPaging="true" PageSize="10"
                  AutoGenerateColumns="false" runat="server"  
                          onrowdatabound="gvClaimSummary_RowDataBound" 
                        onpageindexchanging="gvClaimSummary_PageIndexChanging" 
                        onrowcommand="gvClaimSummary_RowCommand" onrowcreated="gvClaimSummary_RowCreated" 
                        >
                   <Columns>
                  
                  <asp:BoundField HeaderText="Date" DataField="Datecreated" 
                                      HeaderStyle-Width="20%"
                                      ReadOnly="True"  
                                    HeaderStyle-HorizontalAlign="Left"  ItemStyle-HorizontalAlign="Left">
                                    <HeaderStyle  ForeColor="White"></HeaderStyle>
                                    
                                </asp:BoundField>
                               
                                                  
                                <asp:TemplateField HeaderStyle-Width="100px" HeaderText="Category">
                                     <ItemTemplate>
                                     <asp:Panel ID="pnl01" runat="server">
                                        <asp:Label ID="lbcategory" runat="server" Visible='<%# getMultipleVisibility(Eval("Category").ToString()) %>' Text='<%# Eval("Category") + "(+)" %>' />
                                        
                                        </asp:Panel>
                                                                              <br />
                                         <asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" ExpandControlID="pnl01" CollapseControlID="pnl01" TargetControlID="panelmultiplecategory" Collapsed="true"></asp:CollapsiblePanelExtender>    
                                     
                                     <asp:Panel ID="panelmultiplecategory" runat="server"> 
                                         <asp:GridView ID="gvClaimSummaryMini" HeaderStyle-BackColor="#B8A9DC" 
                                          AlternatingRowStyle-BackColor="#E4E0EE" HeaderStyle-ForeColor="White" 
                                                 BorderColor="Black" BorderWidth="1px" Width="810px" 
                                                 RowStyle-VerticalAlign="Top" AllowPaging="true" PageSize="10" 
                                          AutoGenerateColumns="false" runat="server">
                                          <Columns>
                                            <asp:BoundField DataField="Categoryname" HeaderText="Category" HeaderStyle-Width="32%" ReadOnly="true" />
                                            <asp:BoundField DataField="Description" HeaderText="Description" HeaderStyle-Width="29%" ReadOnly="true" />
                                            <asp:BoundField DataField="Details" HeaderText="Details" HeaderStyle-Width="21%" ReadOnly="true" />                                                                   <asp:BoundField DataField="Amount" HeaderText="Amount" HeaderStyle-Width="28%" ReadOnly="true" />                       
                                          </Columns>
                                         </asp:GridView>
                                     
                                     </asp:Panel>
                                     
                                     </ItemTemplate>
                                </asp:TemplateField>
                                                                                               
                                 
                                                                   
                                 <asp:BoundField HeaderText="Description" DataField="Description" 
                                      HeaderStyle-Width="20%"
                                     ReadOnly="True"  
                                    HeaderStyle-HorizontalAlign="Left"  ItemStyle-HorizontalAlign="Left">
                                    <HeaderStyle  ForeColor="White"></HeaderStyle>
                                    
                                </asp:BoundField> 
                                
                                 <asp:BoundField HeaderText="Details" DataField="Detail" 
                                      HeaderStyle-Width="20%"
                                     ReadOnly="True"  
                                    HeaderStyle-HorizontalAlign="Left"  ItemStyle-HorizontalAlign="Left">
                                    <HeaderStyle  ForeColor="White"></HeaderStyle>
                                    
                                </asp:BoundField> 
                                
                                 <asp:BoundField HeaderText="Subtotal" DataField="Subtotal" 
                                      HeaderStyle-Width="20%"
                                     ReadOnly="True"  
                                    HeaderStyle-HorizontalAlign="Left"  ItemStyle-HorizontalAlign="Left">
                                    <HeaderStyle  ForeColor="White"></HeaderStyle>
                                    
                                </asp:BoundField> 
                                
                          
                                <asp:TemplateField HeaderStyle-Width="10%">
                                     <ItemTemplate>
                                            <span style="float:right; padding-right:20px;">
                                                <asp:LinkButton ID="hledit5" runat="server" CssClass="viewbutton" CommandName="EDITCLAIMSUMMARY" CommandArgument='<%# (Container as GridViewRow).RowIndex %>'></asp:LinkButton>
                                                <asp:Label ID="lblID3Field" Visible="false" Text='<%# Eval("UCSID") %>' runat="server" />
                                                <asp:Label ID="lblCateField" Visible="false" Text='<%# Eval("Category") %>' runat="server" />
                                            </span>
                                        </ItemTemplate>
                                         <HeaderTemplate>
                                        <span style="float:right; padding-right:12px;">
                                         <asp:Label ID="lblheader22" runat="server" Text="View" Font-Names="Arial"  ForeColor="White" />
                                        </span>
                                    </HeaderTemplate>
                                        
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderStyle-Width="10%">
                                     <ItemTemplate>
                                            <span style="float:right; padding-right:20px;">
                                                <asp:LinkButton ID="hldeletelevel4" runat="server" CssClass="deletebutton" CommandName="DELETECLAIMSUMMARY" CommandArgument='<%# (Container as GridViewRow).RowIndex %>'></asp:LinkButton>
                                                <asp:Label ID="lblID2Field" Visible="false" Text='<%# Eval("UCSID") %>' runat="server" />
                                            </span>
                                        </ItemTemplate>
                                         <HeaderTemplate>
                                        <span style="float:right; padding-right:12px;">
                                         <asp:Label ID="lblheader24" runat="server" Text="Delete" Font-Names="Arial"  ForeColor="White" />
                                        </span>
                                    </HeaderTemplate>
                                        
                                </asp:TemplateField>
                                
                                
                                
                                
                                
                                
                  </Columns>
                  
                </asp:GridView>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of dimaj
dimaj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of doramail05

ASKER

o.O