Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I store multiple images path in listbox control.
C#
protected void Button2_Click(object sender, EventArgs e)
    {
        string[] files = Directory.GetFiles("C:\\temp\\images", "*.jpg");
        foreach (string cfile in files)
        {
            ListBox3.Items.Add(cfile);

        }
    }


images names are
1.jpg
2.jpg
....
10.jpg
11.jpg 

but when i run above statement the listbox control will display
1.jpg
10.jpg
11.jpg
...
2.jpg
20jpg

so how to sort the listbox control so that list will display like
1.jpg
2.jpg
....
10.jpg
11.jpg
Posted
Updated 8-Jan-12 23:23pm
v2
Comments
anushripatil 9-Jan-12 5:31am    
http://www.beansoftware.com/ASP.NET-Tutorials/ListView-DataPager.aspx

1 solution

rename alphabet form 1.jpg->a.jpg, 2.jpg->b.jpg......25->y.jpg, 26.jpg->z.jpg ..next aa.jpg,bb.jpg...and so on .if posible !
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900