又一个datagrid的问题

obss 2003-09-29 03:42:05
我数据库(access)一个域中存的是1,2,3,4,代表人民币,美元...
如何在datagrid显示时,显示人民币...而不是1,2,3,4?
...全文
73 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cp07 2003-10-17
  • 打赏
  • 举报
回复
嗯,這個正確!記住在datagrid中定義column.mappingname的時候是
datagrid1.column.MappingName= "xxx"
select f1,f2,case
when f3='1' then '人民币'
when f3='2' then '美元'
end as xxx,f4
from table1

如果你覺得不好的話,可以再建立一個表來存儲幣別,這樣就可以用
Select f1,f2,f3,pay_ccy_name from table1
left outer jion Table_pay_ccy on f3=pay_ccy
居然占用名 2003-09-30
  • 打赏
  • 举报
回复
在ItemDataBound事件中判断值,然后用:
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then

' Retrieve the text of the CurrencyColumn from the DataGridItem
' and convert the value to a Double.
Dim strSex As String = e.Item.Cells(3).Text

' Format the value as currency and redisplay it in the DataGrid.
If strSex = "True" Then
e.Item.Cells(3).Text = "上线"
Else
e.Item.Cells(3).Text = "离线"
End If

End If
End Sub
banni2003 2003-09-30
  • 打赏
  • 举报
回复
select f1,f2,case when f3='1' then '人民币'
when f3='2' then '美元' end as xxx,f4.....
from table1
boyors 2003-09-30
  • 打赏
  • 举报
回复
那你就先调个临时表,把数据整理清楚后在和DATAGRID控件连接不就好了。
obss 2003-09-29
  • 打赏
  • 举报
回复
那样不成吧
我的表table1,有很多字段,f1,f2,f3,其中f3为币种,存的是1,2,3,我要在datagrid中显示f1,f2和转换的f3,怎么做?
select f1,f2,f3? from table1
NoReady 2003-09-29
  • 打赏
  • 举报
回复
SLECT 1 AS '人民币',2 AS '美元' FROM TALBE
jQuery EasyUI是一组基于jQuery的UI插件集合,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解的只有一些简单的html标签 1.3.6更新 Bug treegrid: getChecked方法不能返回正确的行. fixed. tree: 异步树,在onlyLeafCheck:true时复选框不显示正确. fixed. Improvement treegrid:继承datagrid组件所有的selecting和checking方法。 linkbutton:图标对齐方式,支持值:'top','bottom','left','right'。 linkbutton:添加"size"属性,支持值:'small','large'。 linkbutton:添加的onClick事件。 menubutton:添加"menuAlign"属性,允许用户设置顶级菜单对齐。 combo:添加"panelAlign"属性,支持值:'left','right'。 calendar:"formatter"、"styler"和"validator"选项可用于自定义日历日期。 calendar:添加的onChange事件。 panel:添加"method","queryParams"和"loader"属性。 panel:添加"onLoadError"事件。 datagrid:添加"onBeginEdit"事件。 datagrid:添加"onEndEdit"事件。 datagrid:添加"sort"方法和"onBeforeSortColumn"事件。 datagrid:"combogrid"编辑器集成到datagriddatagrid:添加"ctrlSelect"属性,允许使用ctrl+click 多选 slider:添加"converter"选项,允许用户决定如何将一个值转换为滑块的位置或滑块位置值。 searchbox:添加"disabled"属性。 searchbox:添加"disabled","enable","clear","reset"方法。 spinner:添加"readonly"属性、"readonly"方法和"onChange事件。

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧