.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Order list by string value

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
Hi, I need to order a list of items, by a string value...e.g. 635, 955, 5820, 1010 should appear as 635,955,1010,5820, however it shows up as 1010, 5820, 635, 955 because it's a string and not an integer.I cannot convert to integer, it must eb a string value. Any suggestions as to how this can be done simply using a string value?

View Complete Post

More Related Resource Links

Is it possible to filter KPI list in order to display only relevant KPIs


I  have created a KPI list and I want to show sections of the list on various parts of my site, however, I dont seem to be able to filter the list. Has anyone tried this and had any success?

.Sort a List problem



I have a little problem with sorting a List<String>.

I have put 4 elements like this and now are trying sort them correct. My example below shows the problem. I am not sure of how sort the names so they comes in this order: "Folder1, Folder2, Folder10, Foler11"  ?

List<String> GetNames = new List<String>();

GetNames .Add("Folder1");
GetNames .Add("Folder10");
GetNames .Add("Folder2");
GetNames .Add("Folder11");

GetNames.Sort(); //Sort the list

The sort comes in this order now which is wrong:

How to sort the list to have this order: ?



How to read a column of a sharepoint list to a text string field of infopath form?

My infopath form used to read these email addresses from a web service and web.config file. Now i would like to get these user email addresses from a contact list in a sharepoint server. I am trying to do this without writing any codes. Here is what i have done so far: 1. Adding a new "data connection to receive data from SharePoint library or List" where i selected Email Address column of the contact list. 2. I added a new Text Field and define a new rule with "Query using a data connection" defined above. When i try to access the newly created Text field above it always return empty as if the Query attached to it did not executed at all. What did i do wrong? Is there a better way? Thank you in advance for your help.

ComboBox Display list does not update if a datasource is a boxed string

I have a combo box databound to a BindingSource bound to a List<Holder> it has Holder.Name as its display value. I also have a text box bound to Holder.Name but if I change the text in the text box it will not change what is displayed in the combo box. Changing selected items and changing back will show the updated text in the text box but will still have the old value displayed in the combo box. How do I make the item in the combo box update? namespace Sandbox_Form { public partial class Form1 : Form { public Form1() { InitializeComponent(); lstBroken = new List<Holder>(); lstBroken.Add(new Holder("test1")); lstBroken.Add(new Holder("test2")); bsBroken = new BindingSource(lstBroken, null); cmbBroken.DataSource = bsBroken; cmbBroken.DisplayMember = "Name"; txtBroken.DataBindings.Add("Text", bsBroken, "Name"); lstWorks = new List<string>(); lstWorks.Add("test3"); lstWorks.Add("test4"); bsWorks = new BindingSource(lstWorks, null); cmbWorks.DataSource = bsWorks; txtWorks.DataBindings.Add("Text", bsWorks, null); } } public class Holder { public Holder(string name) { Name = name; } public string Name { get; set; } } }

How to Sort a List

Hi, I have  aList<String> with textFiles. I wonder how it is possible to sort this List<String> so the  textFiles gets in order starting with the lowest number to the highest number. Now the order is like this and below the example is the sorted order I after to achieve: ( .Sort() does not sort it in this order)List<String> Listing = new List<String>(); Listing.Add("1.txt"); Listing.Add("23.txt"); Listing.Add("12.txt"); Listing.Add("3.txt"); Listing.Add("2.txt"); //Sort so the above list have this order ? Listing.Add("1.txt"); Listing.Add("2.txt"); Listing.Add("3.txt"); Listing.Add("12.txt"); Listing.Add("23.txt");    

How to modify dropdown document template list order when creating document library?

when creating a new document library, the first template is the one for word 2003. Can we change that to word 2007 one? thanks,

how to create a List order and unourder a simple Sql Query

A Simple Query Pass to connection String 1 My Query is SELECT a.HD, a.HEAD, a.SH, a.SUBHEAD, a.TRK, a.TRACK, a.TGT, a.TARGET, a.PDC, a.DT_RELEASE, a.STATUS, a.COFROM V_HIERARCHY1 a   2,My Data is HD    HEAD    SH    SUBHEAD    TRK    TRACK    TGT    TARGET    PDC    DT_RELEASE    STATUS    COHR    HR    Rec    Records    Leave    Leave Records    HRL.0002    Quarterly Review    01.07.2010    04.07.2010    Planned    EdlinkHR    HR1    DB    Database    SAL    Salary    DDS.0001    Calculation of Monthly salary    08.08.2010    09.08.2010    WIP    EdlinkHR    HR    Rec    Records    Ind    Induction Records    HRI.0001    Completion of dossiers.    08.07.2010    10.07.2010    WIP    EdlinkHR    HR  

how to create a list order and unorder using database

how to create a list order and unorder using database

Change order for list view drop down

I may be overlooking something obvious, but I have not been able to find an easy way to sort the views available in the view drop down for lists.  We're migrating to 2010 from WSS 3.0 and currently, the view drop down is sorted alphabetically.   Help?

Passing an List to my Action

    public ActionResult RenderMyThing(IList<String> strings)     {         return View("RenderMyView");     }     Somebody will come to my page, RenderMyThing.aspx ... and I always want to pass a list of strings         routes.MapRoute("MyRoute", "RenderMyThing.aspx", new { controller = "My", action = "RenderMyThing", new List<String> { ... } });    Is this possible?

Cannot send List inside of Dictionary

List<string> receivers = new List<string>(); foreach (object item in listBoxControl1.SelectedItems) receivers.Add((string)item); Dictionary<string, object> inArgs = new Dictionary<string, object>(); inArgs.Add("Receivers", receivers); inArgs.Add("Sender", client.name); inArgs.Add("Message", memoEdit2.Text); inArgs.Add("IsGuaranteedDelivery", true); inArgs.Add("DataType", TransmitToClientDataType.ChatMessage); if (service != null) service.AddTask("orion_send", inArgs); There is an error with serialization at last string because List<string> object. I tryed to send List<T> object via WCF, it's succesfull. But why there are problems with List<T> included to Dictionary?

How to String to Array List

i have a string like   S=""but i want string to convert to Arraylist Ar[0]=1;Ar[1]=2;

Html.DropDownList using a List

This has to be a simple thing, but for whatever reason, I'm just not finding it. I want to use the HTML Helper function to create a DropDownList based on a List<string> (and actually have it bind to the data field on the model).  The simplest example, I suppose, would be: <%: Html.DropDownList("Material", new SelectList(new[] {"Wood","Brick","Metal"})) %> This creates the items in the drop-down, but of course, there's nothing in this line that would bind it to my model (model.Material).  I've done drop-downs with collections of models, where you can bind the Data and Display attributes to properties of the class, but I don't have a class here, just a List. Any ideas?

Re-Order List items not moveable



I have been trying to get the Re-order list to work using the following tutorial (but in VB instead): http://weblogs.asp.net/justinsaraceno/archive/2008/02/22/reorderlist-with-objectdatasource.aspx

The list is displaying properly, but none of the items are moveable. My code is pretty much exactly the same as the tutorial.

Any help is appreciated

ORDER BY items must appear in the select list if SELECT DISTINCT is specified


Hi, i am using a query to get DISTINCT hotels from my Database table sorted by Price and it returns me same hotel times of record found by Price if i use this Query

SELECT distinct(hotelname), availstatus, hoteladdress, hotelphonenumber, hotelpostalcode, destination, starrating, imageurl, hotelcode, TempSession, HotelType, MinimumNightRate from HproTemp where TempSession = '12-53-37' ORDER BY MinimumNightRate

and i get the error "ORDER BY items must appear in the select list if SELECT DISTINCT is specified" When i remove MinimumNightRate from SELECT LIST.

Can anyone have any idea how may i resolve it..

Change order of columns in a list


Hi there

I'm looking for a way to change the order of the colums in a list in SharePoint 2010. I only have access to SharePoint Designer 2010 for editing the site.

I already looked at the function to create custom views for lists. However this are only useful when viewing the list as a whole, however when you edit an existing, or create a new entry you will see

  • first: the columns in the order in which they were created.
  • and second: all of the columns. i cant find a way to make certain columns invisible for the user.
I already looked through the functions that are given to me by SharePoint Designer 2010 when editing the columns of a list and I also checked for a way to change the order of the columns when surfing the actual website with Internet Explorer.

Does anyone know how to do this? Or am I just trying to find a function that doesn't make sense because it's covered by another feature?

Thanks for your help!

Keep updating Session object with a new List c#


I have a Session object

Session["MyListObjects"] = null;

When a user hits a button I want to creat a List<string> object and add to session object.

Let's say if user hits the button 10 times, I would get 10 List<string> objects and
add to Session["MyListObjects"] and

Finally I want to read all the List<string> objects from the session object.

Please let me know how to do that.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend