My home page is displaying images slideshow using jquery,all these images are retrieving from mysql during the run time.I have created 9 images inside the division which are moving by jquery and i am giving the value of image url from codebehind.please see my code below,if database contains lesser than 9 images,null image should be hidden.how can i do it?
<a href="#">
DataTable dt = Db.ids("home_table");
Image1.ImageUrl = "~/Handler1.ashx?id=" + Convert.ToInt16(dt.Rows[0]["id"].ToString());
Image2.ImageUrl = "~/Handler1.ashx?id=" + Convert.ToInt16(dt.Rows[1]["id"].ToString());
This method is followed for all 9 images…
You get an error because you directly access rows that do not exist. You need to count the numbers of rows in your DT.
And after that
etc.