Image control with the ImageUrl bound from DataSource1.
<asp:Image ID="image" runat="server" ImageUrl='<%# Eval("CandidateId", "Picture") %>' />
Below is the DataSource1, brings the Picture field. But the Picture field in the database does not have the full path. It keeps the part of it like: pictures/1250/candidatepicture.jpg
. Full path is sth like: http://abc.storage/pictures/1250/candidatepicture.jpg
.
<asp:SqlDataSource ID="DataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT CandidateId, Picture, Name FROM [Candidates] WHERE ([CandidateId] = @CandidateId)">
<SelectParameters>
<asp:Parameter Name="CandidateId" Type="Int32" />
</SelectParameters>
So when I am using Eval, I need to do sth like ImageUrl='<%# Eval("CandidateId", "http://abc.storage/" + "Picture") %>'
. But obviously this does not work.
What's the way to do?