Dynamically change a picture in asp.net
img src="Images/MainMaster/TruckImg.gif" id="imgCompanyLogo" alt="Company Logo" />
I have an image that i would like to change for each company that logs in to the site.开发者_如何学Go How can i dynamically change that picture to an image stored in my database? Thank you!
You need to have a dictionary that connects a log-in ID to a picture path on your databse. At log-in (or just on PageLoad, I have no idea how your site is set up), just say:
string filePath = ImageTable[loginID]
imgCompanyLogo.ImageURL = filePath;
精彩评论