Can we sort the text alphabetically while entering the data into the textbox and to the database??
I mean if we enter in non alphabetical order it should sort and set it in alphabetical order
ex: Text we are entering like: java, c, donot, cpp
it should now sort it in alphabetical order and store in the database as : c, cpp ,dotnet, java
If there is any method kindly help me to know about it??
1 Replies - 960 Views - Last Post: 18 March 2011 - 04:14 AM
#1
How to sort alphabetically text in the textbox using asp(C#)
Posted 18 March 2011 - 12:31 AM
Replies To: How to sort alphabetically text in the textbox using asp(C#)
#2
Re: How to sort alphabetically text in the textbox using asp(C#)
Posted 18 March 2011 - 04:14 AM
Are you wanting to store the data in the same field in the database?
To sort it in the textbox, simply split the string on the comma, which puts it into an array. Then sort the array, then put the comma back in.
As for the database, if you want to store the 4 values in 4 different ROWS, then there is no need to sort them, as you can write a SQL to sort them when you want to retrieve them. Now if you want to store them in 1 field together, then simply save them to the database after you have sorted them for the textbox.
To sort it in the textbox, simply split the string on the comma, which puts it into an array. Then sort the array, then put the comma back in.
As for the database, if you want to store the 4 values in 4 different ROWS, then there is no need to sort them, as you can write a SQL to sort them when you want to retrieve them. Now if you want to store them in 1 field together, then simply save them to the database after you have sorted them for the textbox.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|