如何在数据网格控件的数据绑定列中交替显示图像? [英] How do you alternate images in a data bound column of a data grid control?

查看:61
本文介绍了如何在数据网格控件的数据绑定列中交替显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据网格控件taht包含一个名为Type的数据绑定coulmn。

取决于Type的值。我想在渲染的表格单元格中显示

中的相应图像。所以,如果type的值是1,我想显示

image1.gif。如果值为2,我想显示image2.gif。有没有简单的

方法呢?


TIA //

I have a data grid control taht contains a data bound coulmn called "Type".
Depending on the value of "Type" I want to display a corresponding image in
the rendered table cell. So, if the value of type is 1, I want to show
image1.gif. If the value is 2, I want to show image2.gif. Is there an easy
way to do this?

TIA//

推荐答案

如果是SQL Server,你可以在你的陈述中这样做:


,''image''+ imageType +''。gif''作为ImageName

-

Gregory A. Beamer

MVP; MCP:+ I,SE,SD,DBA


**************************** ********************** ********************

在盒子外面思考!

************************************* ************* ********************

" C Newby" < ca*@democracydata.com>在消息中写道

news:u8 ************** @ tk2msftngp13.phx.gbl ...
If SQL Server, you can do it in your statement:

, ''image''+imageType+''.gif'' As ImageName

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"C Newby" <ca*@democracydata.com> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
我有一个数据网格control taht包含一个名为
Type的数据绑定库。取决于类型的值。我想在渲染表格单元格中显示相应的图像
。所以,如果type的值是1,我想显示
image1.gif。如果值为2,我想显示image2.gif。是否有一种简单的方法可以做到这一点?

TIA //
I have a data grid control taht contains a data bound coulmn called "Type". Depending on the value of "Type" I want to display a corresponding image in the rendered table cell. So, if the value of type is 1, I want to show
image1.gif. If the value is 2, I want to show image2.gif. Is there an easy
way to do this?

TIA//



对,但是我希望能在运行时确定一些东西。任何

的想法?谢谢你的回复。


" Cowboy(Gregory A. Beamer)" <否************ @ comcast.netNoSpamM>写在

消息新闻:eU ************** @ TK2MSFTNGP11.phx.gbl ...
Right, but i was hoping for something i could determine at run time. Any
thoughts on that? Thanks for your reply.

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote in
message news:eU**************@TK2MSFTNGP11.phx.gbl...
如果是SQL Server,你可以在你的陈述中做到:

,''image''+ imageType +''。gif''作为ImageName

-
Gregory A. Beamer < MVP; MCP:+ I,SE,SD,DBA

******************************** ****************** ********************
在盒子外面思考! ************************************************* * ********************
C Newby < ca*@democracydata.com>在消息中写道
新闻:u8 ************** @ tk2msftngp13.phx.gbl ...
If SQL Server, you can do it in your statement:

, ''image''+imageType+''.gif'' As ImageName

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"C Newby" <ca*@democracydata.com> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
我有一个数据网格控件taht包含一个data bound coulmn called
I have a data grid control taht contains a data bound coulmn called


" Type"。


"Type".

取决于Type的值。我想在
Depending on the value of "Type" I want to display a corresponding image
渲染的表格单元格中显示相应的图像


in


。所以,如果type的值是1,我想显示
image1.gif。如果值为2,我想显示image2.gif。有一个
简单的方法吗?

TIA //

the rendered table cell. So, if the value of type is 1, I want to show
image1.gif. If the value is 2, I want to show image2.gif. Is there an easy way to do this?

TIA//




您还可以在图像单元的数据绑定表达式中编写函数,例如imageurl(或src)=<%#GetMyImage(parms)%>,其中GetMyImage是一个可访问的方法(例如page.getmyimage),parms是你想传递给图像的任何东西(这里的Type的值)案例)


----- C Newby写道:----


对,但是我希望我能确定一些事情在运行时。

的想法?感谢您的回复


" Cowboy(Gregory A. Beamer)" <否************ @ comcast.netNoSpamM>写了我的

消息新闻:eU ************** @ TK2MSFTNGP11.phx.gbl ..
You can also write a function in your databinding expression for the image cell, e.g. imageurl (or src)=<%# GetMyImage(parms) %>, where GetMyImage is an accessible method (e.g. page.getmyimage), and parms is whatever you want to pass to get the image (the value of Type in this case)

----- C Newby wrote: ----

Right, but i was hoping for something i could determine at run time. An
thoughts on that? Thanks for your reply

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote i
message news:eU**************@TK2MSFTNGP11.phx.gbl..
如果是SQL Server,你可以在你的陈述中做
If SQL Server, you can do it in your statement
,''image''+ imageType +''。gif''作为ImageNam
-
, ''image''+imageType+''.gif'' As ImageNam
--


Gregory A. Beame MVP; MCP:+ I,SE,SD,DB


Gregory A. Beame
MVP; MCP: +I, SE, SD, DB

******************************** ****************** *******************
************************************************** *******************


在盒子外面思考
********************************************* *** *******************
C Newby < ca*@democracydata.com>在消息中写道
新闻:u8 ************** @tk2msftngp13.phx.gbl ..


Think Outside the Box
************************************************** *******************
"C Newby" <ca*@democracydata.com> wrote in messag
news:u8**************@tk2msftngp13.phx.gbl..

我有一个数据网格控件包含一个数据bound coulmn calle
I have a data grid control taht contains a data bound coulmn calle


" Type"


"Type"

取决于Type的值我想显示一个相应的imag
Depending on the value of "Type" I want to display a corresponding imag


i

渲染的表格单元格。所以,如果type的值是1,我想知道
image1.gif。如果值为2,我想显示image2.gif。有没有
方法来做这个
the rendered table cell. So, if the value of type is 1, I want to sho
image1.gif. If the value is 2, I want to show image2.gif. Is there a eas way to do this
TIA /
>>
TIA/
>>



这篇关于如何在数据网格控件的数据绑定列中交替显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆