Click here to Skip to main content
13,045,641 members (68,862 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: , +
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">

<separatorstyle bordercolor="ActiveBorder" borderstyle="Double" font-bold="true" />

<items>

<igtbar:tbarbutton key="Edit" text="Edits" xmlns:igtbar="#unknown">

<Images>

<defaultimage url="images/edit_icon.jpg" />

</Images>



<igtbar:tbarbutton key="New" text="New" xmlns:igtbar="#unknown">

<Images>

<defaultimage url="images/add_new_icon.jpg" />

</Images>



<igtbar:tbarbutton text="Delete" key="Delete" xmlns:igtbar="#unknown">

<Images>

<defaultimage url="images/delete_icon.jpg" />

</Images>









 



 



<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"

StyleSetName="Claymation">



<displaylayout allowcolsizingdefault="Free" allowdeletedefault="Yes" bordercollapsedefault="Separate">

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%">

</FrameStyle>

<pager allowpaging="True" minimumpagesfordisplay="2" stylemode="ComboBox" pagesize="15">

<pagerstyle backcolor="LightGray" borderstyle="Solid" borderwidth="1px">

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" />





<editcellstyledefault borderstyle="None" borderwidth="0px">



<footerstyledefault backcolor="LightGray" borderstyle="Solid" borderwidth="1px">

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" />



<footerstyledefault backcolor="LightGray" borderstyle="Solid" borderwidth="1px">

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" />

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px">





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

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" />

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px">



</HeaderStyleDefault>

<rowstyledefault backcolor="Window" bordercolor="Silver" borderstyle="Solid" borderwidth="1px">

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

<padding left="3px" />

<borderdetails colorleft="Window" colortop="Window" />

<padding left="3px">

<borderdetails colorleft="Window" colortop="Window">



<groupbyrowstyledefault backcolor="Control" bordercolor="Window">



<SelectedRowStyleDefault BackColor="Green">

</SelectedRowStyleDefault>

<groupbybox hidden="True">

<boxstyle backcolor="ActiveBorder" bordercolor="Window">





<addnewbox hidden="False">

<boxstyle backcolor="Window" bordercolor="InactiveCaption" borderstyle="Solid" borderwidth="1px">

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" />

<borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px">







<activationobject bordercolor="" borderwidth="">



<filteroptionsdefault filteruitype="HeaderIcons" allowrowfiltering="OnClient" filtercomparisontype="CaseSensitive">

<filterdropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid" borderwidth="1px">

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

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

<padding left="2px" />



<filterhighlightrowstyle backcolor="#151C55" forecolor="White">



<filteroperanddropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid">

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

Font-Size="11px">

<padding left="2px" />









<bands>

<igtbl:ultragridband datakeyfield="CustomerId" hidden="false" xmlns:igtbl="#unknown">

<columns>

<igtbl:ultragridcolumn basecolumnname="CustomerId" isbound="true">

<Header Caption="Sno">

</Header>



<igtbl:ultragridcolumn width="35%" basecolumnname="CustomerName" isbound="true">

<Header Caption="CustomerName">

<rowlayoutcolumninfo originx="1">

</Header>



<rowlayoutcolumninfo originx="1">





<igtbl:ultragridcolumn width="25%" basecolumnname="CustomerAddress">

<Header Caption="Address">

<rowlayoutcolumninfo originx="1" />

</Header>



<rowlayoutcolumninfo originx="1" />





<igtbl:ultragridcolumn width="20%" basecolumnname="Cityname">

<Header Caption="City Name">

<rowlayoutcolumninfo originx="2" />

</Header>



<rowlayoutcolumninfo originx="2" />





<igtbl:ultragridcolumn width="20%" basecolumnname="Gender">

<Header Caption="Gender">

<rowlayoutcolumninfo originx="4">

</Header>



<rowlayoutcolumninfo originx="4">





<igtbl:templatedcolumn hidden="true">

<HeaderTemplate>

Select

</HeaderTemplate>

<celltemplate>

<asp:Button ID="btnSelect" runat="server" CommandName="Select" Text="Select" />



<Header Caption="Select">

<rowlayoutcolumninfo originx="3" />

</Header>



<rowlayoutcolumninfo originx="3" />







<addnewrow view="NotSet" visible="NotSet">













 



 



 



 



 



 

<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<cusomer_city> BindGv()

{



IList<city> lstCityExtract= new List<city>();

IList lstCustomerExtract = new List<customers>();



IList<cusomer_city> ooCusomer_City = new List<cusomer_city>();

try

{

Customers o = new Customers();

oSessionFactory = new SessionFactory();

I_session = oSessionFactory.Getsession("thkspf");

trans = I_session.BeginTransaction();

IList<city> Lst = new List<city>();

Lst = I_session.CreateCriteria<city>().Add(Restrictions.Disjunction()

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

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



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<city>();



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";

ooCusomer_City.Add(oCusomer_City);

}



}


catch (Exception ex)

{

trans.Rollback();

throw ex.InnerException;

}

return ooCusomer_City;

}

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 19 Apr 2012
Copyright © CodeProject, 1999-2017
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