Hi,
I am trying to display image from database using dynamic label from C# code.
I need to save the image in this format in my database:
<img src="http://localhost:64278/Quiz/Upload/tinyUpload_quizStudent/bateau.jpg" alt="bateau.jpg" />
I am using this code:
protected void btnUploadTiny_Click(object sender, EventArgs e)
{
if (FileUploadTiny.HasFile)
{
string FileNameDeltaker = System.IO.Path.GetFileName(FileUploadTiny.PostedFile.FileName);
string FilePathDeltaker = "~/Quiz/Upload/tinyUpload_quizStudent/" + FileNameDeltaker;
FileUploadTiny.SaveAs(Server.MapPath(FilePathDeltaker));
txtQuestionName.Text += string.Format("<img src = '{0}' alt = '{1}' />", FilePathDeltaker, FileNameDeltaker);
}
}
I have used different cenario, but it does not save in the format I want:
txtQuestionName.Text += "<img src = 'http://localhost:64278/Quiz/Upload/tinyUpload_quizStudent/" + FileNameDeltaker + "'" + "/>";
Below is my Label that will read the image:
mylabel.Text = "Question: " + myreader["QuestionName"].ToString() ";
It can only read the image if the following format is saved in database:
<img src="http://localhost:64278/Quiz/Upload/tinyUpload_quizStudent/bateau.jpg" />
How to solve this ?
Many Thanks in advance