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

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

In RB 2.0 how to sort in ascending/descending order as default?

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :Sql Server
I have column say of Provider Type which I want to be ordered when report is run so that all other columns are ordered according to the order of the Provider Type values.

View Complete Post

More Related Resource Links

What is the meaning of Ascending\descending sort order of a column within an index

When I add a new index I can also specify the "sort order" as ascending or descending. What does it mean? does it affect performance? does it mean that the binary search tree will be set in a certain way?

WPF: how to make a GridView only sort on one column as ascending order?


We use GridView inside the Listview. We need the grid view alwasy sort on one column ascending order and not allow to click column header to change it.

Is there a easy way to achieve it in Xaml?

If not possible, how to achieve it in code behind?



Looking for TSQL statement that returns customers with greatest number of order in descending order

What would be an efficient TSQL SELECT statement that joins customer and order tables, counts the orders for each customer (group by) and returns a result for all customers with at least one order, and also in descending order from customers with the most orders to the least?

Dynamic Data Entity Framework: Initial Sort Order for Views

Hello Steve,I'm trying to set an initial sort order for my View (not table) in Dynamic Data using Entity Framework 2. I have updated my Model and Imported the View. Now I'm trying to use the DisplayColumn attibutebut it's not working.[DisplayColumn("Product", "ParsingOrder", true)]Fabio

Dundas Map - Legend sort order

ello, We are using Dundas Maps together with Reporting Services 2008. Now we have come across a problem which we are not able to solve ourselves.   We produce a map showing each countries “ReportingFormat”. The SQL in the background  has the “order by ReportFormat” clause.   The values available in “ReportFormat” are shown in the legend. So far everything looks fine and the values within the legend are ordered correctly (E2B, Intdis, Not specified). See the picture http://img340.imageshack.us/i/correctorderfrompreview.jpg/   We therefore deploy the report and open it up in Internet Explorer but now the order of the legend has changed and is shown as (Intdis, Not specified, E2B). See the picture http://img816.imageshack.us/i/incorrectorderfromie.jpg/   We have tried to set the sorting also within the map (not only within the SQL) but the same problem remained although we are not sure we set that sorting correctly . We are not sure that we found the series collection where we could set the sort order. It is all a bit confusing when working with the maps.   As a final solution we tried to change the available values in “ReportFormat” but then the order was even more confusing. See table below; Available values (ReportFormat) Order in legend in Visual studio preview Order in legend in Internet

order by sort both select in union



I have DropDownList that Show all groups. in that, I want to show "select one group" as default in DDL. for that i used code below. but it sort all return data and "select one group" will not be the first line. How can i fix it?

Best Regards. Morteza


	SELECT   -1 as id,'select one group' as groupName
	SELECT   id, groupName
	FROM     [group] 
	order by groupNam

reorderlist sort descending


Im using Ajax Reorderlist.

It works just fine unless I change the Select statement to sort DESC.  Then the sort field (int) just accrues values instead of just switching them around.

Something I can do to make this work properly?  Id really prefer to sort this list in DESC order.

SSRS 2005 and Sort Order

I have a table and want to sort the 1st column which is called "WorkType" in a particular order. At present it looks like this.

Admin Tasks
Leave & Public Holiday

managed metadata sort order for swedish


Sort order for managed metadata is not as expected, for instance Swedish letters Å and Ä are sorted as A

The properties for the standard language is set to swedish and explicit sort order is not set.

Is this a bug, or are we doing something wrong?


Microsoft SharePoint Server 2010 (14.0.4763.1000)

Language Pack for SharePoint, Project Server and Office Web Apps 2010 - Swedish/svenska (14.0.4763.1000)

Change Default Sort for Dynamic Data Web Application




I just created a dynamic data web application and setup a simple .EDMX file. Next, I created meta-data / partial classes to ensure that my integer identifiers wouldn't show up:

// ...


public object TableId { get; set; }

 // ...

I wanted to now set the up the list pages so they sort using a different attribute ("Name" in this case). Anyone know if this is possible / how to do it?






Persist sort order in datagrid



I've got multiple datagrids in the application I'm currently working on. Their ItemSource can be updated with new content on server notifications. When this happens, the ItemSource is being replaced by a new one (would it be better to update the content of the ItemSource - which is much more complicated for this case of figure - instead of binding a new one?)

When the new ItemSource is being bound, the sorting of the grid is being lost. I've solved this behaviour by saving the sorting before setting the new binding and restoring it after the new binding has been done. Below you'll find the static methods used for that:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows.Controls;
using System.Windows.Data;
using Telecontrol.SIPPR.Client.Commons.DataObjects;

namespace Telecontrol.SIPPR.Client.Commons.Utils
  public static class DataGridUtil

coalesce building pivot column headers - making them descending instead of ascending


Hi, I was somewhat surprised and happy to see that the t-sql statement below can be used to dynamically build my pivot column headers.   I was also surprised to see that either it is smart enought to build the headers alphabetically or I'm incredibly lucky.  Date is a char(7) column in my table with format yyyy/mm.

Anyway, it would be really cool for me if the headers were build descending instead of ascending.  I tried using a view to do this but the thing has a mind of its own.  I'll start writing a function but would like to know if the community knows of a better way. 

It generates a string that looks something like ...




@PivotColumnHeaders VARCHAR

need of Ascending order based on the Date and month.


Hi friends,

query.Append("SELECT Name, Sex, Marital_Status, Dob, Anniversary, Mobile, Email FROM Client WHERE ");

            if (startDate > new DateTime() && endDate > new DateTime())
                query.Append("(DATEADD(YEAR,DATEDIFF(YEAR, DOB,'" + startDate + "'),DOB) BETWEEN '" + startDate + "'AND'" + endDate + "' OR DATEADD(YEAR,DATEDIFF(YEAR, ANNIVERSARY,'" + startDate + "'),ANNIVERSARY) BETWEEN '" + startDate + "'AND'" + endDate + "') AND ");
           if (!string.IsNullOrEmpty(maritalStatus) && !string.Equals("All", maritalStatus))
                query.Append(" Marital_Status = '" + maritalStatus + "'");

            string resultQuery = query.ToString();
            if (resultQuery.Trim().EndsWith("AND", StringComparison.OrdinalIgnoreCase))
                int lastIndex = resultQuery.LastIndexOf("AND");
                resultQuery = resultQuery.Remove(lastIndex, 3);

            if (resultQuery.Trim().EndsWith("WHERE"))
                int lastIndex = resultQuery.LastIndexOf("WHER

SharePoint 2010 library sort order is incorrect.


When sorting by name in a SharePoint 2010 library, numeric results are sorting incorrectly. For instance "122_Test" will sort in front of "13_Test". I know at one point years ago Windows Explorer had the same issue, but when viewing the same library by using the Open with Explorer option, Windows Explorer correctly displays the results. Has anyone encountered this issue, and if so have you found a fix?


Tim Vander Kooi

Datatable sort in a particular order


How do I sort a data table based on a particular column which has integer values in ascending order?


I wrote this:

leadtable.DefaultView.Sort = "Id"

But it doesnt seem to work, it displays fine but when i get try to get the values of the sorted datatable in an array they dont come in an sorted ordere

Datatble is defined as:


  • leadtable = New DataTable("LeadTable")   
  •         Dim leadid As New DataColumn("Id")   
  •         leadi
  • How can I use ORDER BY by passing different columns and sort orders?


    Hi all

    Here is what I am trying to do:

    declare @dateBegin as datetime, @dateEnd as datetime
    declare @column as varchar(30), @order as varchar(4)
    set @dateBegin = null
    set @dateEnd  = null
    set @column  = 'created'
    set @order   = 'DESC'
    	(@dateBegin is null or startTime >= @dateBegin) and (@dateEnd is null or endTime <= @dateEnd)
    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