Last post Feb 24, 2021 03:18 AM by Sean Fang
Feb 23, 2021 12:11 PM|salmanm22|LINK
I'm working on dynamic datasite LINQ SQL admin panel where tables are displayed to edit, insert or delete. In a table , Image Column it shows the url of image. I want to display the image instead of URL. and when edit there should be a file upload button
and file should be saved in folder of website. Type for Image= navarchar MAX
Feb 23, 2021 12:19 PM|mgebhard|LINK
Use the image tag to display an image.
File upload is covered in the official docs for the unknown framework you are working in.
If you need further assistance, share your code. Explain the expected results and the actual results.
Feb 24, 2021 03:18 AM|Sean Fang|LINK
You should share the codes so that we know how you implement this dynamic data in webforms.
Regarding how to display the image instead of URL, you could directly assign the url to the image control or convert the image to base64 format and assign the value to the image control.
If the control is of type dynamic, you might need to find dynamic control in the project and modify it as an image control in code behind.
Convert image to base64:
using (Image image = Image.FromFile(imagePath))
using (MemoryStream m = new MemoryStream())
byte imageBytes = m.ToArray();
// Convert byte to Base64 String
string base64String = Convert.ToBase64String(imageBytes);
// Assign the base64 string to the Image control
Image1.ImageUrl = "data:image/png;base64," + base64String;