i am fetching the image from the folder
i have one folder called digital in that folder lot of images are there
Desintation CHN - TBM (Label Name)
in that digital folder CHN - TBM image is there. i want to check the image name and label name should be same. then display image
My code as follows
protected void Page_Load(object sender, EventArgs e)
{
string imgname = lbltext.Text.ToString();
string folderPath = Server.MapPath("digital/" + imgname);
if (folderPath == imgname.ToString())
{
lblresult.Text = folderPath;
}
}
But in folder path i get as follows when i check using break point
D:\Dot Net Practical Excercise\WebApplication1\WebApplication1\digital\CHN - TBM
from the above i want to get only CHN - TBM
in my above code what is the mistake i made.
i have one folder called digital in that folder lot of images are there
Desintation CHN - TBM (Label Name)
in that digital folder CHN - TBM image is there. i want to check the image name and label name should be same. then display image
My code as follows
protected void Page_Load(object sender, EventArgs e)
{
string imgname = lbltext.Text.ToString();
string folderPath = Server.MapPath("digital/" + imgname);
if (folderPath == imgname.ToString())
{
lblresult.Text = folderPath;
}
}
But in folder path i get as follows when i check using break point
D:\Dot Net Practical Excercise\WebApplication1\WebApplication1\digital\CHN - TBM
from the above i want to get only CHN - TBM
in my above code what is the mistake i made.

Midhun TpRank #388 · 6.5K reputationPosted Jul 30, 2016, 5:10 AM EDT
{
string imgname = lbltext.Text.ToString();
string folderPath = Server.MapPath("digital/" + imgname+".jpg");
if (File.Exists(folderPath))
{
//
}
}
Ehsan SajjadRank #512 · 4.8K reputationPosted Jul 30, 2016, 5:25 AM EDT