Click here to Skip to main content
11,920,377 members (57,635 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET NHibernate , +
i am working with UltraWebGrid

when i click on header of column for sorting its giving me error

The data source 'ObjectDataSource1' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.

here is my Source code


<igtbar:UltraWebToolbar ID="UltraWebToolbar2" runat="server" önButtonClicked="UltraWebToolbar1_ButtonClicked">









<igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel2" runat="server" Height="20px"

Width="100%" BackImageUrl="~/images/plus.gif">

<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataKeyField="CustomerId" EnableAppStyling="True"

Width="100%" DataSourceID="ObjectDataSource1" Browser="Xml" önItemCommand="gvInfra_ItemCommand"


HeaderClickActionDefault="SortMulti" Name="UltraWebGrid1" RowHeightDefault="20px"

SelectTypeRowDefault="Extended" StationaryMargins="Header" StationaryMarginsOutlookGroupBy="True"

TableLayout="Fixed" Version="4.00" ViewType="OutlookGroupBy" AutoGenerateColumns="False"

AllowUpdateDefault="Yes" RowSelectorsDefault="Yes" LoadOnDemand="Xml" AllowColumnMovingDefault="OnClient">

<FrameStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid"

BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt" Width="100%">


<HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid" HorizontalAlign="Left">


Font-Names="Microsoft Sans Serif" Font-Size="8.25pt">

<SelectedRowStyleDefault BackColor="Green">


CustomRules="overflow:none;" Font-Names="Verdana,Arial,Helvetica,sans-serif"

Font-Size="11px" Height="300px" Width="200px">

BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif"








<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="BindGv"

DataObjectTypeName="Customer" TypeName="OFRS.Development">


Here is my code to call function which is used with ObjectDataSource

public IList BindGv()


IList lstCityExtract= new List();

IList lstCustomerExtract = new List();

IList ooCusomer_City = new List();



Customers o = new Customers();

oSessionFactory = new SessionFactory();

I_session = oSessionFactory.Getsession("thkspf");

trans = I_session.BeginTransaction();

IList Lst = new List();

Lst = I_session.CreateCriteria().Add(Restrictions.Disjunction()

.Add(Restrictions.Eq("Cityname", "Karachi"))

.Add(Restrictions.Eq("Cityid", 2))).List();

string CustomerQuery = "select cust.* from Customer cust inner join city c on c.cityid=cust.cityid";

ISQLQuery oIqueryCustomer = I_session.CreateSQLQuery(CustomerQuery).AddEntity(typeof(Customers));

lstCustomerExtract = oIqueryCustomer.List();

foreach (Customers cust in lstCustomerExtract)


Cusomer_City oCusomer_City = new Cusomer_City();

lstCityExtract = I_session.CreateCriteria(typeof(City)).Add(Restrictions.Eq("Cityid", cust.Cityid)).List();

oCusomer_City.CustomerName = cust.CustomerName;

oCusomer_City.CustomerId = cust.CustomerId;

oCusomer_City.CustomerAddress = cust.CustomerAddress;

oCusomer_City.Cityid = lstCityExtract[0].Cityid;

oCusomer_City.Cityname = lstCityExtract[0].Cityname;

oCusomer_City.Gender = cust.Gender==1?"Male":"Female";




catch (Exception ex)



throw ex.InnerException;


return ooCusomer_City;


kindly help me manage it
Posted 19-Apr-12 1:20am

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

  Print Answers RSS
0 OriginalGriff 415
1 phil.o 170
2 Dave Kreskowiak 155
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,495
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,805
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 19 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100