如何与if和else if和else一起使用Eval [英] How to use Eval with if and else if and else

查看:89
本文介绍了如何与if和else if和else一起使用Eval的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我想在多个条件下使用eval.
我想根据角色加载图像.
角色1,2,3,4,5,6.如果roleid为1,我需要加载一个简单的图像.如果是2,则另存一张图片...以此类推.


在这种情况下,如何在图像中使用Eval.


在此先感谢.


问候
froxy

Hi All

I wan to use eval with multiple conditions.
I want to load the image based on the Role.
The Roles 1,2,3,4,5,6. If the roleid is 1, i need to load a simple image. And if it is 2 another image... and so on.


In this scenario how to use Eval in the image.


thanks in advance.


regards
froxy

推荐答案

为了提高可读性,在很多方面都做得更好,在方法后面调用代码并传递您的值,以便您的逻辑保持不变.您的代码而不是您的ASPX.
You''re better off in a lot of ways, for readability, calling a code behind method and passing in your value, so that your logic stays in your code behind and not your ASPX.


这篇关于如何与if和else if和else一起使用Eval的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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