image rendering

shortj

New member
Joined
Jul 25, 2007
Messages
1
Programming Experience
1-3
Hi

I have got a datagrid which, has an asp:image tag embedded through the columns, i have it pulling in the image url from a database.

It does all this succesfully, but it jus won't render the images in the browser, it jus shows my alternative text.

Is there somthing i am not doing? do i have to write a method for rendering these, if so how would i go about it?

here is my code

any help would be great, cheers

Boyindie

HTML:
<form id="form1" runat="server">
    <div>
          
        <asp:DataGrid runat=server ID=dgImage AllowPaging="True" AutoGenerateColumns="False"   DataKeyField="imageId">
        <Columns>
        <asp:BoundColumn DataField=imageId HeaderText="Image ID" ></asp:BoundColumn>
        <asp:TemplateColumn HeaderText=Products  >
        <ItemTemplate >
        <asp:Image  runat=server ID=imageHolder imageurl='<%#databinder.eval(container.dataitem,"imageAddress")%> ' Width=60 Height =80 BorderWidth =1 AlternateText='<%#databinder.eval(container.dataitem,"imageAddress")%> ' />      
        </ItemTemplate>
        </asp:TemplateColumn>
        <asp:ButtonColumn HeaderText="View item" CommandName=getDetails ButtonType=PushButton Text=Select></asp:ButtonColumn>
        </Columns>
          
        </asp:DataGrid>
        
      
    </form>
</body>


VB.NET:
'Builds .net mysql connection and passes connection string into method
        Dim connection As New MySqlConnection(connectionString)
        'Open connection to DB
        connection.Open()

        'Create mySql command string for passing query or SPROC(Stored Procedure)
        Dim cmdString As New MySqlCommand
        'Set Command to equal mySql connection, so can pass SQL query
        cmdString.Connection = connection
        'Set command string to equal SPROC
        cmdString.CommandText = "sp_image"
        'ONLY PLACE THIS IF SPROC, sets the command to a SPROC
        cmdString.CommandType = CommandType.StoredProcedure


        'Create dataAdaptor for passing data between .net and mySQL
        Dim dataAdaptor As New MySqlDataAdapter

        'Sets command object to datAdaptor
        dataAdaptor.SelectCommand = cmdString


        'Creates a dataset which will be filled with data from
        'dataAdaptor
        Dim ds As New DataSet
        dataAdaptor.Fill(ds)

        'Creates Table which is filled data from dataset
        Dim dataTable As New DataTable


        dataTable = ds.Tables(0)



        'Sets datagrids source to datatable
        dgImage.DataSource = dataTable
        'binds ds to datgrid
        dgImage.DataBind()
 
Back
Top