I know this is probably a simple question, but I can't see how to do it. I have the web address of an image stored (e.g http://www.mysite.com/image.gif) in SQL Server and would like to display the image in my web page (I am using C#).<BR><BR>Can anyone help?? Many thanks<BR><BR>Jamiefirst, nothing is easy (at least for me) in .NET =) <BR>But I hope this helps.<BR><BR><%@ Page Language="C#" %><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.SqlClient" %><BR><%@ Import Namespace="System.IO" %><BR><BR><BR><html><BR><title>Templated Columns - Images</title><BR><style><BR> a {behavior:url(....mouseover.htc);}<BR> hr {height:2px;color:black;}<BR> .StdText {font-family:verdana;font-size:9pt;font-weight:bold;}<BR> .StdTextBox {font-family:verdana;font-size:9pt;border:solid 1px black;filter
rogid
XImageTransform.Microsoft.dro pshadow(OffX=2, OffY=2, Color='gray', Positive='true');}<BR> .Shadow {filter
rogid
XImageTransform.Microsoft.dropshad ow(OffX=2, OffY=2, Color='gray', Positive='true');}<BR> iframe {border:solid 1px black;filter
rogid
XImageTransform.Microsoft.dro pshadow(OffX=2, OffY=2, Color='gray', Positive='true');height:220px;}<BR></style> <BR><BR><BR><script runat="server"><BR>public void Page_Load(Object sender, EventArgs e)<BR>{<BR> // Initialize only the first time...<BR> if (!Page.IsPostBack)<BR> {<BR> lblURL.Text = Request.Url + "<hr>";<BR> }<BR>}<BR><BR>public void OnLoadData(Object sender, EventArgs e)<BR>{<BR> UpdateView();<BR>}<BR><BR><BR>public void PageIndexChanged(Object sender, DataGridPageChangedEventArgs e) <BR>{<BR> grid.CurrentPageIndex = e.NewPageIndex;<BR><BR> // Refresh the grid<BR> UpdateView();<BR>}<BR><BR><BR>private bool IsImageAvailable(String strLastName)<BR>{<BR> String strImageFile = "images\" + strLastName + ".bmp";<BR> return File.Exists(Server.MapPath(strImageFile));<BR>}<BR><BR><BR>private void UpdateView()<BR>{<BR> SqlConnection conn = new SqlConnection(txtConn.Text);<BR> SqlDataAdapter da = new SqlDataAdapter(txtCommand.Text, conn);<BR> <BR> DataSet ds = new DataSet();<BR> da.Fill(ds, "MyTable");<BR><BR> // Bind the data<BR> grid.DataSource = ds.Tables["MyTable"];<BR><BR> // Display the data<BR> grid.DataBind();<BR>}<BR><BR></script><BR><BR><BR><body bgcolor="ivory" style="font-family:arial;font-size:small"><BR><BR><!-- ASP.NET topbar --><BR><h2>Editing Columns with Images</h2><BR><asp:Label runat="server" cssclass="StdText" font-bold="true">Current path: </asp:label><BR><asp:Label runat="server" id="lblURL" cssclass="StdText" style="color:blue"></asp:label><BR><BR><form runat="server"><BR><BR> <table><BR> <tr><BR> <td><asp:label runat="server" text="Connection String" cssclass="StdText" /></td><BR> <td><asp:textbox runat="server" id="txtConn"<BR> Enabled="false"<BR> cssclass="StdTextBox"<BR> width="700px"<BR> text="DATABASE=Northwind;SERVER=localhost;uid=sa;passwor d=;" /></td></tr> <BR><BR> <tr><BR> <td><asp:label runat="server" text="Command Text" cssclass="StdText"/></td><BR> <td><asp:textbox runat="server" id="txtCommand" <BR> Enabled="false"<BR> width="700px"<BR> cssclass="StdTextBox"<BR> text="SELECT employeeid, titleofcourtesy, firstname, lastname, hiredate, title, notes, country FROM Employees" /></td></tr></table> <BR><BR> <BR> <BR> <asp:linkbutton runat="server" text="Go get data..." onclick="OnLoadData" /><BR><BR> <hr><BR><BR> <asp
ataGrid id="grid" runat="server" <BR> AutoGenerateColumns="false"<BR> CssClass="Shadow" BackColor="white"<BR> CellPadding="2" CellSpacing="0" <BR> BorderStyle="solid" BorderColor="black" BorderWidth="1"<BR> font-size="x-small" font-names="verdana"<BR> AllowPaging="true"<BR> PageSize="4"<BR> DataKeyField="employeeid"<BR> OnPageIndexChanged="PageIndexChanged"><BR><BR> <AlternatingItemStyle BackColor="palegoldenrod" /><BR> <ItemStyle BackColor="beige" VerticalAlign="top" /><BR> <EditItemStyle BackColor="yellow" Font-Bold="true" /><BR> <PagerStyle Mode="NumericPages" /><BR> <HeaderStyle ForeColor="white" BackColor="brown" HorizontalAlign="center" Font-Bold="true" /><BR><BR> <columns><BR><BR> <asp:BoundColumn runat="server" DataField="employeeid" HeaderText="ID"> <BR> <itemstyle backcolor="lightblue" font-bold="true" HorizontalAlign="right" /><BR> </asp:BoundColumn><BR><BR><BR> <asp:TemplateColumn runat="server" HeaderText="Employee Name"> <BR> <itemtemplate><BR> <asp:label runat="server" <BR> Text='<%# DataBinder.Eval(Container.DataItem, "TitleOfCourtesy") + "<b> " + <BR> DataBinder.Eval(Container.DataItem, "LastName") + "</b>" + ", " + <BR> DataBinder.Eval(Container.DataItem, "FirstName") %>' /> <BR> </itemtemplate><BR> </asp:TemplateColumn><BR><BR> <asp:TemplateColumn runat="server" HeaderText="Photo"><BR> <itemtemplate><BR> <img runat="server" width="50" <BR> visible='<%# IsImageAvailable(DataBinder.Eval(Container.DataIte m, "lastname").ToString()) %>' <BR> src=http://aspmessageboard.com/archive/index.php/'<%# "images/" + DataBinder.Eval(Container.DataItem, "lastname") + ".bmp" %>' /><BR> <asp:label runat="server" text="<i><small>No picture available.</small></i>" <BR> visible='<%# !IsImageAvailable(DataBinder.Eval(Container.DataIt em, "lastname").ToString()) %>' /><BR> </itemtemplate><BR> </asp:TemplateColumn><BR><BR> </columns><BR> </asp
ataGrid><BR><BR><BR> <asp:label runat="server" id="lblCurrent" /><BR></form><BR><BR></body><BR></html><BR>







