c# - How to Insert image on web page using image name pulled from access database? -


i'm developing website. have access database pull image names want use parameters post images folder using c# code in vs 2010. want know how access image name string , insert asp image element. i'm guessing need store results of "select" query in variable in order pass through "eval" function, i'm guessing , nor have figured out how it.

the following section of code established connection database, used datalist control list information on webpage code for. , i'm trying use file name that's in database parameter grab correct image files , post web page. see below in code filename goes here????? see need put filename picture.

<asp:accessdatasource id="accessdatasource2" runat="server"       datafile="~/app_data/traveljoansdb.accdb"       selectcommand="select * [table2]"></asp:accessdatasource>      <asp:datalist id="datalist1" datasourceid="accessdatasource2"               itemstyle-verticalalign="middle" runat="server" datakeyfield="id">          <itemstyle verticalalign="middle"></itemstyle>          <itemtemplate>                  id:                 <asp:label id="idlabel" runat="server" text='<%# eval("id") %>' />                 <br />                 image:                 <asp:image id="image1" runat="server" imageurl='<%# "placeimages/" eval(*filename goes here?????*) %>' />                 <br />                 <br />          </itemtemplate>             </asp:datalist> 

try this

<asp:image id="image2" runat="server" imageurl='<%# "placeimages/" + eval("your_imagename_column")%>' /> 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -