I am trying to display random images
heres my code
private void Page_Load(object sender, EventArgs e)
{
int num1=0;
Random randNum = new Random();
num1 = randNum.Next(0, 9);
Image1.ImageUrl = DisplayNumber(num1);
Image1.Visible=true;
}
protected string DisplayNumber(int i)
{
string imagepath="";
switch (i)
{
case 0:
imagepath = "~/fordoctor/doctor_login/images/0.GIF";
break;
case 1:
imagepath = "~/fordoctor/doctor_login/images/1.GIF";
break;
case 2:
imagepath = "~/fordoctor/doctor_login/images/2.GIF";
break;
case 3:
imagepath = "~/fordoctor/doctor_login/images/3.GIF";
break;
case 4:
imagepath = "~/fordoctor/doctor_login/images/4.GIF";
break;
case 5:
imagepath = "~/fordoctor/doctor_login/images/5.GIF";
break;
case 6:
imagepath = "~/fordoctor/doctor_login/images/6.GIF";
break;
case 7:
imagepath = "~/fordoctor/doctor_login/images/7.GIF";
break;
case 8:
imagepath = "~/fordoctor/doctor_login/images/8.GIF";
break;
case 9:
imagepath = "~/fordoctor/doctor_login/images/9.GIF";
break;
}
Session["num1"] = imagepath;
return imagepath;
}
but it displays nothing i have even checked the images using Response.Write(Session["num1"].ToString()); and the images get displayed at the next page