且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从asp.net中的不同不同图像文件夹中加载图像控件中的图像

更新时间:2023-10-10 14:17:16

简单

试试下面的代码

Simple

try the following code

int i = 0;
i = VBMath.Rnd() * 100;
if (i < 50) {
    Image1.ImageUrl = "~/img1/myimg.JPG";
} else {
    Image1.ImageUrl = "~/img2/1.JPG";



img1和img2是包含图像的文件夹.
我使用随机数来演示代码.您必须根据需要进行更改.



img1 and img2 are folders containing images.
I''ve used random numbers to demonstrate the code. You have to change it according to your need.