Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0"Failed to compare two elements in the array.""Failed to compare two elements in the array."
Previous
 
Next
New Post
9/25/2008 5:26 AM
 

when i click the sort options in my module

This error will shown :

"Failed to compare two elements in the array."

This help will greatly appricitated.

Thanks

 
New Post
9/25/2008 8:02 AM
 

Although you provided very little information to help solve the problem, I'll take a guess and ask a couple of additional questions that my point you in the correct direction.

1. Is this a module that you have created or a core or third-party module. If core or third-party, please advise which core module or seek help from the vendor if it is a thrid-party module.

2. If this is your own module and you are sorting an array of custom class objects (rather than than System.String or numeric) , have you implemented the IComparable interface (with a CompareTo method) in the custom class or have you created a class which implements the IComparer interface and specified an instance of that class in Array.Sort?

3. Have you logged in as administrator or host user and looked at the more detailed error message in the Event Viewer? If so and #2 above does not help you, please post the complete error - especially the stack trace.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
9/25/2008 10:09 AM
 


Sorry for not being very clear.

1. I am developing my own module and it is for image slide show.

2. I am not using System.String ,numeric and IComparabel interface.

3. I am using Class  of  Imageclick event  to move the postions of the items.

4. when i click the move button it  simply displays the below error messages, not a detailed error message.

"Failed to compare two elements in the array."

Thanks.
 

 
New Post
9/25/2008 6:54 PM
 

Still not enough information to go on . . . let's try this:

1. Am I correct that you find no detailed error logged in the Event Viewer related to this error?
2. Are you sorting an Array, ArrayList or Generic.List?
3. Am I correct that the elements of the list are custom classes? If so, have you implemented either IComparable (with its CompareTo method) on the element class or defined a comparer class which implements IComparer? Depending on the type of the list, one or the other will be necessary to compare two instances of the custom class.
4. Is there any possibility that either one of the instances of the custom class (or the property being compared) is null?

If you're still stuck, please post code showing how the list is constructed, the overload of Sort that is being called, and either the IComparable implementation in the custom class or the comparer class implementing IComparer.


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
9/26/2008 12:15 AM
 

Hi Bill,


Again sorry for not being very clear.


    1. My module concept:  i upload the images from fileupload to repeatercontrols with buttons( this button for move to previous or next from list(repeater  control/any selected items).


    2. My Queston : When i click the move button that same error "Failed to compare two elements in the array."
        Please see the given code for move to previous button.
        .ascx
        <asp:ImageButton ImageUrl="~/Images/Previous.gif" ID="BtnPrevious"OnCommand="Previous_Routine" CommandName="Previous"                                  CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ItemId") %>' runat="server" />

        .ascx.cs
protected void Previous_Routine(object sender, CommandEventArgs e)
        {
            Controller obj = new Controller();
            List<Info> lstItems = objs.Gets(this.ModuleId);
            lstItems.Sort();
            int Sorter = 0;
            foreach (Info obj in lstItems)
            {
                obj.SortId = Sorter;
                objs.Update(obj);              
                Sorter++;
            }
            for (int i = 0; i < lstItems.Count; i++)
            {
                Info obj = (Info)lstItems[i];
                if (obj.ItemId == Convert.ToInt32(e.CommandArgument.ToString()))
                {
                    if (i == 0)
                    {
                        break;
                    }
                     obj.SortId--;
                     objs.Update(obj);                

                     obj = (Info)lstItems[i - 1];
                     obj.SortId++;
                     objs.Update(obj);                   
                }
            }

            //refresh cache
            SynchronizeModule();

            ExportXml(false);

            Response.Redirect(Request.Url.AbsoluteUri, true);
}

Thanks

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0"Failed to compare two elements in the array.""Failed to compare two elements in the array."


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out