Unable to use Custom table to order data

Thiago De Faria Franca asked on October 28, 2015 02:03

Hi there,

I am using a custom table to order the data that are displaying on my client website. I added a alternative form, I can filter the results but when I try to use the arrow (up or down) it refresh the page and I can not get the data ordered. Is there an way to not refresh the page after I click in the arrow?

Recent Answers


Laura Frese answered on October 28, 2015 17:17

Hi Thiago,

Can you provide more details? You are storing data in a custom table, what type of repeater web part are you using to display the data? Did you create a custom one or are you using one of the pre-installed custom table repeaters?

0 votesVote for this answer Mark as a Correct answer

Thiago De Faria Franca answered on October 28, 2015 23:37 (last edited on October 29, 2015 04:05)

Hi Laura,

I am using a custom repeater that is ordering the items using the custom table field "ItemOrder". So when the client order the custom table in the CMS moving items up and down it would change the order that the data appears on the website.

The problem is that I added filter using alternative forms to the custom table in the CMS but when you use the filter attempting to moving the items, it refresh the page and the ItemOrder doe not change.

Screen Shoots: link text link text link text

0 votesVote for this answer Mark as a Correct answer

Timothy Fenton answered on November 4, 2015 11:02

Hello Thiago

Could you post some examples of your custom code so that we review it and see if we can find what is wrong? You are saying that this is a custom repeater, but how is the arrow up / down handled? It sounds like it is making a postback to the page and this refreshes the filter which makes sense if you are not handling postback in the filter

1 votesVote for this answer Mark as a Correct answer

Thiago De Faria Franca answered on November 23, 2015 06:08

Hello Timothy,

This is the front end of the repeater:

<asp:Repeater ID="uiRptCommitteeMemberDetails" runat="server" OnItemDataBound="uiRptCommitteeMember_OnItemDataBound"> </asp:Repeater>

And that is the back end:

protected void Page_Load(object sender, EventArgs e) { DataBindControl(); }

/// <summary>
/// DataBind controls
/// </summary>
public void DataBindControl() {

    uiPhViewCommitteeMemberInDetail.Visible = false;
    uiPhViewCommitteeMember.Visible = false;
    string siteName = SiteContext.CurrentSite.SiteName;
    DataTable table = null;

    if (MembershipContext.AuthenticatedUser.IsGlobalAdministrator || CIA.Data.CommitteeMember.IsCommityMember()) {
        uiPhViewCommitteeMemberInDetail.Visible = true;
        table = CommitteeMember.GetAllMembers(DocumentContext.CurrentDocument.NodeGUID, true, "ItemOrder, Committee, Role");
        uiRptCommitteeMemberDetails.DataSource = table;
        uiRptCommitteeMemberDetails.DataBind();
    } else {
        uiPhViewCommitteeMember.Visible = true;
        table = CommitteeMember.GetAllMembers(DocumentContext.CurrentDocument.NodeGUID, true, "ItemOrder, Committee, Role");
        uiRptCommitteeMember.DataSource = table;
        uiRptCommitteeMember.DataBind();
    }

    if (table == null) {
        this.Visible = false;
        return;
    }

    if (table.Rows.Count == 0) {
        this.Visible = false;
        return;
    }


}

    public static DataTable GetAllMembers(Guid activityNodeGUID, bool? display, string orderBy)
    {
        DataSet testDs = null;

        QueryDataParameters parameters = new QueryDataParameters();
        parameters.Add("@ActivityNodeGUID", activityNodeGUID);
        parameters.Add("@Display", display);


        //Call the query that is defined through Kentico CMS
        if (string.IsNullOrEmpty(orderBy)){
            orderBy = "ORDER BY ItemID";
        } else if (!orderBy.StartsWith("ORDER BY", StringComparison.OrdinalIgnoreCase)) {
            orderBy = string.Concat("ORDER BY ", orderBy);
        }
        testDs = ConnectionHelper.ExecuteQuery("CIA.ActivityCommitteeMember.selectMemberUserDetails", parameters, null, orderBy);

        return testDs.Tables[0];
    }

So as you can see I am getting the data from the custom table and it is ordered by ItemID but I can't order by item id using the custom table application inside the CMS. Because I need to filter it and as soon I click in the arrow the page refreshes and the filter got lost.

Hope that helps Thanks Thiago

0 votesVote for this answer Mark as a Correct answer

Timothy Fenton answered on November 23, 2015 10:09

Hey Thiago, thanks for this - can i also see the markup in the alternative form where you are adding the filter, i suspect something may be going on with the combination of the two.

0 votesVote for this answer Mark as a Correct answer

Thiago De Faria Franca answered on November 24, 2015 00:03

Hi Timothy,

Thanks for your answer. I am actually using just the automatically generated form layout.

0 votesVote for this answer Mark as a Correct answer

Timothy Fenton answered on November 24, 2015 10:47

Hello Thiago, i was referring to the alternative form that you were referring to here: "The problem is that I added filter using alternative forms to the custom table". Either way I basically wanted to see how and where the filter is implemented as it is not in the code sample you provided

0 votesVote for this answer Mark as a Correct answer

Thiago De Faria Franca answered on December 10, 2015 04:35

Hello Timothy,

Thanks for your answer but I think that I am not getting exactly what you want.

The alternative form that I am using does not implement any custom markup. Please look the screen shot link text

If is not that what you want to know, can you please, explain me a bit better about it?

Thanks Thiago de Faria Franca

0 votesVote for this answer Mark as a Correct answer

Thiago De Faria Franca answered on March 29, 2016 00:44

Hi There, any update on this one? Thank you

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.