选中单选按钮时显示图像 [英] Displaying Image when a radiobutton is checked

查看:86
本文介绍了选中单选按钮时显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要当单选按钮被选中在aspx页以显示图像.可以随机更改图像吗?

我没有使用过任何数据库.有可能吗?

感谢

I need to display an image in an aspx page when a RadioButton is checked. Can the image can be changed randomly.

I haven''t used any DB. Is it possible?

Thanks

推荐答案

而不是数据库,而是使用对图像URL具有一些ID的XML文件.使用Random类的Next方法创建ID范围内的随机ID.然后从XML中找到随机ID的图片网址.将图像网址设置为图像控件.

Instead of database use an XML file which has some id against the image url. Use Random class''s Next method to create a random ID with in your ID ranges. Then from the XML find the image url for the random id. Set the image url to the image control.

Is this works?


Albin的问题很好.我只想注意RadioButton的使用.无论您使用这种按钮做什么,都会给用户带来样式滥用和极大的困惑. RadionButton设计用于从静态选项集中进行选择.任何随机性都是不充分的.

为了您的目的,您只应使用一些无状态控件,例如常规的Button.

谢谢.

—SA
The Question by Albin is good. I only want to note on the use of RadioButton. Whatever you do with this kind of button would be the style abuse and big confusion to the user. The RadionButton is designed for a selection from the static set of options. Any randomness is inadequate.

For your purpose, you only should use some stateless control, such as regular Button.

Thank you.

—SA


这篇关于选中单选按钮时显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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