nopCommerce team | a.m. wrote:Nop_Picture
Andrei ,
I am trying to create a gridview in which i want to display username along with the avatar image but i am not getting image:
this is what i have done till now:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="CustomerID" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID"
InsertVisible="False" ReadOnly="True" SortExpression="CustomerID" />
<asp:BoundField DataField="Username" HeaderText="Username"
SortExpression="Username" />
<asp:BoundField DataField="AvatarID" HeaderText="AvatarID"
SortExpression="AvatarID" />
<asp:TemplateField>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("PictureBinary") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("PictureBinary") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=.\SQLEXPRESS;Initial Catalog=mydatabase;Integrated Security=True"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT Nop_Customer.CustomerID, Nop_Customer.Username, Nop_Customer.AvatarID, Nop_Picture.PictureBinary FROM Nop_Customer CROSS JOIN Nop_Picture">
</asp:SqlDataSource>
-------
and this is the output i am getting:
CustomerID Username AvatarID
37
[email protected] 6 X
37
[email protected] 6 X
37
[email protected] 6 X
37
[email protected] 6 X
38
[email protected] 5 X
38
[email protected] 5 X
38
[email protected] 5 X
38
[email protected] 5 X
i am getting X sign instead of image, and i have checked in the database that the avatar ID that i am getting is correct. could you please help me with this issue ?