I had applied sorting in the ajax combobox and things are working fine except one special case in one of my combobox: All the items are displayed in sorted(order by Names) below -- Select --, but one item is displayed above select. I have checked the Id as well and the Id is also '1388' where the Id of --Select -- is '0'.
Can anyone predict what can be the reason? aspx code:
<ajax:ComboBox ID="LendersCmbx" runat="server" Width="150px" CssClass="AquaStyle textfont"
OnSelectedIndexChanged="LendersCmbx_SelectedIndexChanged" AutoPostBack="true"
DropDownStyle="DropDownList" AutoCompleteMode="SuggestAppend" CaseSensitive="false"
ItemInsertLocation="OrdinalText">
</ajax:ComboBox>
My aspx.cs code:
LendersCmbx.DataSource = LenBobj.FillLenders();
LendersCmbx.DataTextField = "LenderName";
LendersCmbx.DataValueField = "LenderId";
LendersCmbx.DataBind();
My BL Code:
public List<Lender> FillLenders()
{
return obj.GetLenders();
}
and DAL Code:
public List<Lender> GetLenders()
{
return context.Lenders.OrderBy(Lender=>Lender.LenderName).ToList();
}