Removing Repeating Cell Values

2 posts, 0 answers
  1. Justin
    Justin avatar
    11 posts
    Member since:
    Jul 2012

    Posted 10 Apr 2013 Link to this post

    <telerik:GridTemplateColumn Datafield="customer_cd" HeaderStyle-Width="20%"
        HeaderText="Customer" ItemStyle-HorizontalAlign="Center" SortExpression="end_dt"
        ItemStyle-VerticalAlign="Middle" UniqueName="customer_cd">
                    <col />
                        <asp:HyperLink ID="hlCustomerCd" runat="server" ImageUrl='<%# string.Format("icons/{0}.gif",Eval("customer_cd")) %>' NavigateUrl='<%# string.Format("customer.aspx?org_cd={0}&cust_id={1}", org_cd, Eval("customer_id"))  %>'
                            Text='<%# Eval("customer_nm").ToString() %>' />
                        <br />
                        <asp:Label ID="lblCustomerCd" runat="server" Text='<%# Eval("customer_nm").ToString() %>' Font-Size="X-Small" />
                        <br />
                        <asp:HyperLink ID="hlAgreementNo" runat="server" NavigateUrl=' <%# string.Format("agreement.aspx?org_cd={0}&cust_id={1}&agmt_id={2}", org_cd, Eval("customer_id"), Eval("agreement_id"))%>' Text='<%# "Agreement:" + Eval("customer_purchase_order_no") %>' ForeColor="#2dabc1" />

    protected void rgSite_PreRender(object sender, EventArgs e)
        //The Row Index is the Row above the bottom row, walk up the Grid
        for (int rowIndex = rgSite.Items.Count - 2; rowIndex >= 0; rowIndex += -1)
            //The Current Row is the row index
            GridDataItem row = rgSite.Items[rowIndex];
            //The Previous Row is one below it
            GridDataItem previousRow = rgSite.Items[rowIndex + 1];
            //Grab the ItemTemplate Text values from the Hyperlink of the current and previous row and compare them.
            if ((row["customer_cd"].FindControl("hlCustomerCd") as HyperLink).Text == (previousRow["customer_cd"].FindControl("hlCustomerCd") as HyperLink).Text)
                //The Top Row Absorbs the previous Rowspan
                row["customer_cd"].RowSpan = previousRow["customer_cd"].RowSpan < 2 ? 2 : previousRow["customer_cd"].RowSpan + 1;
                //The previous row then goes away.
                previousRow["customer_cd"].Visible = false;

    This is sort of a minor adjustment to the solution given in another forum to allow for the same thing in a Grid Template Column. 
  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 10 Apr 2013 Link to this post

    Hi Justin,

    What exactly are the 'repeating cell values' ? Are you referring to the Units, Diff. Factor, and Remarks? If these are the same for each item in an AGREEMENT then you could consider creating a Hierarchical Grid and bounding these repeating cells to each AGREEMENT itself. You could achieve this functionality by following this demo:

    Hopefully this helps,
    Master Chief
  3. DevCraft R3 2016 release webinar banner
Back to Top