I want to allow users to download pictures from SQL that will become their background while on my site.
I already use the uploaded pictures as foreground objects in various places, so I know the storage and the retrieval is working, which I normally DataBind()
to an asp:FormView
, but now I'm trying to use this image as the background in <body>
, but <body>
expects a URL string.
This is what I have. I'm having a difficult time with this one and couldn't find an answer.
<body style="background-image:url(<%# GetBodyStyle() %>">
Code-behind:
public object GetBodyStyle()
{
object bodyBackgroundImageUrl = BodyBackgroundImageUrl;
//Make adjustments
return bodyBackgroundImageUrl;
}
I have another subroutine that gets my images from the DB called FetchImage, which returns a datatable:
protected object BodyBackgroundImageUrl
{
get
{
DataCalls DataCall = new DataCalls();
return DataCall.FetchImage("MyBackgroundImageID");
}