Sorting Generic List
//Sorting List<> case Item is ListItem //============================================== List<ListItem> tempList = new List<ListItem>(); tempList.Insert(0, new ListItem("------------- Vehicle Reports 8")); tempList.Insert(0, new ListItem("------------- Vehicle Reports 2")); tempList.Insert(0, new ListItem("------------- Vehicle Reports 4")); // sort asc tempList.Sort(delegate(ListItem p1, ListItem p2) { return p1.Text.CompareTo(p2.Text); }); // sort desc tempList.Sort(delegate(ListItem p1, ListItem p2) { return p2.Text.CompareTo(p1.Text); }); //Sorting List<> case Item is Object Class //=============================================== //Apply to sorting in GridView //=============================================== SortData(e.SortExpression, NewSortDirection, ref listMsgTicker); //=============================================== #region method for sorting private void SortData(string _expression, SortDirection _direction, ref List<MsgTicker> data) { //sort asc == if (_direction == SortDirection.Ascending) data.Sort(delegate(MsgTicker a, MsgTicker b) { switch (_expression) { case "MsgHeader": return a.MsgHeader.CompareTo(b.MsgHeader); case "CreatedDate": return a.CreatedDate.CompareTo(b.CreatedDate); case "ModifiedDate": return a.ModifiedDate.CompareTo(b.ModifiedDate); default: throw new NotImplementedException("Type of property not implemented yet"); } }); //sort desc == if (_direction == SortDirection.Descending) data.Sort(delegate(MsgTicker a, MsgTicker b) { switch (_expression) { case "MsgHeader": return b.MsgHeader.CompareTo(a.MsgHeader); case "CreatedDate": return b.CreatedDate.CompareTo(a.CreatedDate); case "ModifiedDate": return b.ModifiedDate.CompareTo(a.ModifiedDate); default: throw new NotImplementedException("Type of property not implemented yet"); } }); //return data; } #endregion ref: http://dotnetslackers.com/Community/blogs/simoneb/archive/2007/06/20/How-to-sort-a-generic-List_3C00_T_3E00_.aspx
How to… move from AjaxPro to ASP.NET AJAX PageMethods
How to… move from AjaxPro to ASP.NET AJAX PageMethods
AJAX For Beginners
What is AJAX? AJAX stands for Asynchronous JavaScript and XML. AJAX uses a combination of Javascript and XML to allow web pages to be updated with new data from the server. It consists of HTML, JavaScript, DHTML, and DOM. The traditional way of processing data between client’s browser and a server was to submit a HTML form and send data to the server, the server processed the data and sent a response back to the browser.
The disadvantage of this method is that the web page must be reloaded in the browser. As a new and outstanding approach, AJAX allows to write web-applications without reloading the page on user interaction. By using AJAX, we can create better, faster and easier to use web applications.
| AJAX Introduction AJAX Basic AJAX Display Contents AJAX Get and Post AJAX and Database AJAX and XML AJAX Dynamically Update Data |
ajax javascript tip
Chat with ASP.NET and Ajax
http://www.codegod.de/WebAppCodeGod/a-chat-with-aspnet-and-ajax-AID356.aspx
http://www.codegod.de/WebAppCodeGod/a-chat-with-aspnet-and-ajax-AID356.aspx
http://particletree.com/features/preloading-data-with-ajax-and-json/
Alternate Ajax Techniques, Part 1
http://www.webreference.com/programming/ajax_tech/
Alternate Ajax Techniques, Part 2
http://www.webreference.com/programming/ajax_tech2/
table sort javascript
http://www.mattkruse.com/javascript/sorttable/#
Description:
A common need is to have a table of results or data in the browser and to let the user sort the columns in the browser without needing to go back to the server each time.
This complex script allows that functionality using extensive DHTML.
In older browsers (<4) no sorting will happen, and in Netscape the tables may not contain form elements if you wish them to be sorted.
Example:
(Click on the plain text column headers to sort)
| Submitted | |||||||
| Sel | Order Num | S | Ref | Date | Serial | ||
|---|---|---|---|---|---|---|---|
|
1
|
43870
|
14Jun2000
|
|
||||
|
1
|
43810
|
14Jun2000
|
|
||||
|
1
|
43727
|
14Jun2000
|
|
||||
|
1
|
43949
|
14Jun2000
|
|
||||
|
1
|
43598
|
02Jun2000
|
|
||||
|
1
|
43894
|
14Jun2000
|
|
||||
|
1
|
43794
|
12Jun2000
|
|
||||
|
1
|
43928
|
14Jun2000
|
|
||||
|
1
|
43640
|
14Jun2000
|
|
||||
| Name | ID | Bonus |
|---|---|---|
|
Mary Doe
|
111
|
$765.43
|
|
John Doe
|
12345
|
$500.00
|
|
James Baker
|
555
|
$0.99
|
Random number
randomnumber = Math.round(14 * Math.random());
document.write (randomnumber);
Asynchronous Callbacks and Ajax based UI Experience in Web Applications
Web applications work on the underlying Http protocol and Http is stateless by nature. It uses the Request - Response pattern between the client and the server, to process the logic at the server and present the information in HTML to the client browser. In the case of long running applications, it would be helpful to the end user to see some status on the browser when the application is processing some complex logic on the server. This article shows a convenient way of showing status information in such cases. The sample demos show how to achieve this in .NET 2.0 using the CallBack infrastructure provided in the framework and also a means to achieve the same effect using the .NET 1.1 framework.
ref: http://www.c-sharpcorner.com/UploadFile/deepakvraghavan/AjaxProgressBars09082006171908PM/AjaxProgressBars.aspx