1
我有一個應顯示curreny +金額的字段金額。因爲,我無法提供'$'200的fieldName我已經設置爲未綁定的字段。發生排序但填充的數據不正確。我有數量從40到500.但排序降序顯示100和升序顯示99.9 請幫助解決此問題。如何使用DevExpress ASPxGridView對字段進行排序
//設計師
<dx:ASPxGridView ID="gridReports" runat="server" Width="100%" KeyFieldName="SID" ClientInstanceName="gridReports"
onpageindexchanged="gridReports_PageIndexChanged" onrowcommand="gridReports_RowCommand" AutoGenerateColumns="False" oncustomunboundcolumndata="gridReports_CustomUnboundColumnData" oncustomcolumndisplaytext="gridReports_CustomColumnDisplayText">
<SettingsBehavior EnableRowHotTrack="true" /> <SettingsPager AlwaysShowPager="true" Position="Bottom" PageSize="25" />
<Columns>
<dx:GridViewDataColumn CellStyle-HorizontalAlign="right" Width="24%" Caption="AMOUNT" VisibleIndex="5" UnboundType="Decimal" FieldName="ForeName" Settings-SortMode="Value">
</Columns>
<SettingsBehavior ConfirmDelete="True" /> <SettingsBehavior ConfirmDelete="True" EnableRowHotTrack="True" /> <SettingsPager AlwaysShowPager="True" PageSize="25"> </SettingsPager>
//代碼
protected void gridReports_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e)
{
if (e.Column.FieldName == "ForeName")
{
string currency = (string)e.GetListSourceFieldValue("DEFAULT_CURRENCY");
string amount = (string)e.GetListSourceFieldValue("AMOUNT");
e.Value = GTYPE(currency) + amount;
}
}
請不,我已經給定值和displayText在 'gridReports_CustomColumnDisplayText' 但分揀因此未採取place.I已經改變UnboundType整數和小數。
試過這種方法也:
protected void gridReports_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDisplayTextEventArgs e)
{
if (e.Column.FieldName == "ForeName")
{
object currency = e.GetFieldValue("DEFAULT_CURRENCY");
object amount = e.GetFieldValue("AMOUNT");
e.DisplayText = ((string)GTYPE(currency.ToString()) + amount);
e.Value = Decimal.Parse(amount.ToString());
}
}
請張貼的所有代碼爲您dxGridView – BossRoss
@ BossRoss:感謝您的時間來解決這個問題。找到解決方案,並在下面發佈。 – psobhan