i am merging cells with equal value (webform)
the merge cells are working, but how to retain merged cells during edit mode?
i am using the example template field from www.marss.co.ua/2010/01/how-to-merge-cells-with-equal-values-in.html
i have not seen any sample code that supports edit mode
code behind
aspx page
- <asp:GridView ID="gvAgentDueBalanceList" runat="server" AutoGenerateColumns="False"
- CellPadding="4" CellSpacing="2" Width="100%" AllowPaging="False"
- PageSize="40" AllowSorting="True"
- CssClass="Grid"
- AlternatingRowStyle-CssClass="alt"
- PagerStyle-CssClass="pgr"
- OnPreRender="gvAgentDueBalanceList_PreRender"
- OnRowDataBound="gvAgentDueBalanceList_RowDataBound"
- OnRowCommand="gvAgentDueBalanceList_RowCommand"
- OnRowCancelingEdit="gvAgentDueBalanceList_RowCancelingEdit"
- OnRowEditing="gvAgentDueBalanceList_RowEditing"
- OnRowUpdating="gvAgentDueBalanceList_RowUpdating"
- OnRowDeleting="gvAgentDueBalanceList_RowDeleting"
- EmptyDataText="No record found"
- EnableModelValidation="True">
- <Columns>
- <asp:TemplateField HeaderText="Bag User" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
- <ItemStyle HorizontalAlign="Left" Width="90px" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblBagUser" runat="server" Text='<%# Eval("BagUser") %>'></asp:Label>
- --%>
- <asp:Label ID="Label0" runat="server" Text='<%# Eval("BagUser") %>'></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Curr" ShowHeader="False" HeaderStyle-HorizontalAlign="Center">
- <ItemStyle HorizontalAlign="Center" Width="30px" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblCurrencyCode" runat="server" Text='<%# Eval("CurrencyCode2") %>'></asp:Label>
- --%>
- <asp:Label ID="Label1" runat="server" Text='<%# Eval("CurrencyCode2") %>'></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Due Amount" ShowHeader="False" HeaderStyle-HorizontalAlign="Center">
- <ItemStyle HorizontalAlign="Center" Width="80px" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblTotalAmountDue" runat="server" Text='<%# Eval("TotalAmountDue", "{0:#,0.00}") %>'></asp:Label>
- --%>
- <asp:Label ID="Label2" runat="server" Text='<%# Eval("TotalAmountDue", "{0:#,0.00}") %>'></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField Visible="false" HeaderText="Agent SN" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
- <ItemStyle HorizontalAlign="Left" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblBagID" runat="server" Text='<%# Eval("BagID") %>'></asp:Label>
- --%>
- <asp:Label ID="Label3" runat="server" Text='<%# Eval("BagID") %>'></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField Visible="false" HeaderText="SH ID" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
- <ItemStyle HorizontalAlign="Left" Width="90px" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblShareID" runat="server" Text='<%# Eval("ShareID") %>'></asp:Label>
- --%>
- <asp:Label ID="Label4" runat="server" Text='<%# Eval("ShareID") %>'></asp:Label>
- </ItemTemplate>
- </asp:TemplateField>
- <%--
- --%>
- <asp:TemplateField HeaderText="Action" ShowHeader="False" HeaderStyle-HorizontalAlign="Center">
- <ItemStyle HorizontalAlign="Center" Width="100px" />
- <ItemTemplate>
- <asp:LinkButton ID="lnkBtnPayment" runat="server" CausesValidation="false" CommandName="Payment">Payment</asp:LinkButton>
- |
- <asp:LinkButton ID="lnkBtnView" runat="server" CausesValidation="false" CommandName="View">View</asp:LinkButton>
- </ItemTemplate>
- </asp:TemplateField>
- <%--
- --%>
- <asp:TemplateField HeaderText="Edit" ShowHeader="False" HeaderStyle-HorizontalAlign="Center">
- <ItemStyle HorizontalAlign="Center" Width="100px" />
- <ItemTemplate>
- <asp:Label Visible="false" ID="lblEditBagID" runat="server" Text='<%# Eval("BagID") %>'></asp:Label>
- <asp:LinkButton ID="lnkBtnEdit" runat="server" CausesValidation="false" CommandName="Edit">Edit</asp:LinkButton>
- </ItemTemplate>
- <EditItemTemplate>
- <asp:LinkButton ID="lnkBtnUpdate" runat="server" CausesValidation="false" CommandName="Update">Update</asp:LinkButton>
- |
- <asp:LinkButton ID="lnkBtnCancel" runat="server" CausesValidation="false" CommandName="Cancel">Cancel</asp:LinkButton>
- </EditItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Name" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
- <ItemStyle HorizontalAlign="Left" Width="150px" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
- --%>
- <asp:Label ID="Label7" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
- </ItemTemplate>
- <EditItemTemplate>
- <asp:TextBox ID="txtGridEditName" runat="server" Text='<%# Bind("Name") %>' onKeypress="Javascript:if(window.event.keyCode==13){this.focus();return false;}" Width="130px" CssClass="tbEditModeStyle" MaxLength="35"></asp:TextBox>
- </EditItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Contact" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
- <ItemStyle HorizontalAlign="Left" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblContact" runat="server" Text='<%# Eval("Contact").ToString().Replace("\n", "<br />") %>'></asp:Label>
- --%>
- <asp:Label ID="Label8" runat="server" Text='<%# Eval("Contact").ToString().Replace("\n", "<br />") %>'></asp:Label>
- </ItemTemplate>
- <EditItemTemplate>
- <asp:TextBox ID="txtGridEditContact" runat="server" Text='<%# Bind("Contact") %>' TextMode="MultiLine" Height="40px" Width="92%" CssClass="tbEditModeStyle" MaxLength="255"></asp:TextBox>
- </EditItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Account Ref." ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
- <ItemStyle HorizontalAlign="Left" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblAccount" runat="server" Text='<%# Eval("Account").ToString().Replace("\n", "<br />") %>'></asp:Label>
- --%>
- <asp:Label ID="Label9" runat="server" Text='<%# Eval("Account").ToString().Replace("\n", "<br />") %>'></asp:Label>
- </ItemTemplate>
- <EditItemTemplate>
- <asp:TextBox ID="txtGridEditAccount" runat="server" Text='<%# Bind("Account") %>' TextMode="MultiLine" Height="40px" Width="92%" CssClass="tbEditModeStyle" MaxLength="255"></asp:TextBox>
- </EditItemTemplate>
- </asp:TemplateField>
- <asp:TemplateField HeaderText="Remarks" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
- <ItemStyle HorizontalAlign="Left" />
- <ItemTemplate>
- <%--
- <asp:Label ID="lblRemark" runat="server" Text='<%# Eval("Remark").ToString().Replace("\n", "<br />") %>'></asp:Label>
- --%>
- <asp:Label ID="Label10" runat="server" Text='<%# Eval("Remark").ToString().Replace("\n", "<br />") %>'></asp:Label>
- </ItemTemplate>
- <EditItemTemplate>
- <asp:TextBox ID="txtGridEditRemark" runat="server" Text='<%# Bind("Remark") %>' TextMode="MultiLine" Height="40px" Width="92%" CssClass="tbEditModeStyle" MaxLength="255"></asp:TextBox>
- </EditItemTemplate>
- </asp:TemplateField>
- </Columns>