0

HI,

I am quite new in this field.I am developing one C# web application .can you help me with following stuff.

I want to Display images from a folder which contains nearly 1000 images.

That image files in folder(means image itself) has names like 15_1,15_2,15_5,15_40,18_1,18_3... where first field is id which i have to compare with plantid field and if match found then show all the images i.e. say plantid=15 then if plantid=imgeid is true then show the images with names 15_1,15_2,15_5,15_40

1.how i will get that 15 for comparison?
2.which control is used to show images?

Please help me !

Thanks in advance for spending time here for me.thanks again!!!

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Renukavani
0

First of all thanks for ur replay!!!!!

that plantid is some datavalue like that 15
and i have to match that plantid means 15 with image names like15_1,15_5,16_1,16_4....
if match found that is in our case image names 15_1,15_5,
I have to show this two images on web page.
it may be in slide set or with next prev button.

Even i am not sure which control to be use?

0

u can get 15 for compare with plantid by th following steps..

first take the substring of image name (int i=imagename.indexOf(_);
string substring=imagename.substring(0,i);)
and
convert it into int.parse(substring)

0

u can get 15 for compare with plantid by th following steps..

first take the substring of image name (int i=imagename.indexOf(_);
string substring=imagename.substring(0,i);)
and
convert it into int.parse(substring)

thanks fro ur valuable replay !let me check this then i will tell u what happens

0

Ramsham,

Check this code

protected void Page_Load(object sender, EventArgs e)
    {
        string plantid  = "15";
        string strimagelist = "15_1,15_2,15_5";
        string[] strimagecomma = strimagelist.Split(',');
        string[] strimageunderscore = null;
        foreach (string strcompare in strimagecomma)
        {
            strimageunderscore = strcompare.Split('_');
            for (int i = 0; i < strimageunderscore.Length; i++)
            {
                if (plantid == strimageunderscore[i])
                {
                    Image img = new Image();
                    img.ID = "img" + strimageunderscore[i] + "_" + strimageunderscore[i + 1];
                    img.ImageUrl = "~/Images/" + strimageunderscore[i] + "_" + strimageunderscore[i + 1] + ".jpg";
                    pnlView.Controls.Add(img);
                    break;
                }
            }
            strimageunderscore = null;
        }

    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.