Hi folks,
Been struggling with this little puzzle.
I am reading the MemberInfo table for the ClubStarterKit, the table includes the Avatar for the User.
I would like to display the Avatar as an image in a databound element, in this case I am resorting to Gridview although I would prefer datalist or something simpler.
<code>
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server" ConnectionStrin g="<%$ connectionStrin gs:ClubSiteDB %>"
SelectCommand=" SELECT aspnet_Users.Us erName, aspnet_Users.Us erId, Attendance.numo fguest, MemberInfo.avat ar FROM Attendance INNER JOIN aspnet_Users ON Attendance.memb er = aspnet_Users.Us erId INNER JOIN MemberInfo ON Attendance.memb er = MemberInfo.memb erid WHERE (Attendance.eve ntid = @id)">
<SelectParamete rs>
<asp:QueryStrin gParameter DefaultValue="1 " Name="id" QueryStringFiel d="EventId" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
<asp:GridView ID="GridView1" runat="server" AllowPaging="Tr ue"
DataSourceID="S qlDataSource2" CellPadding="4" ForeColor="#333 333" GridLines="None " AutoGenerateCol umns="False" DataMember="Def aultView">
<FooterStyle BackColor="#990 000" Font-Bold="True" ForeColor="Whit e" />
<Columns>
<asp:BoundFie ld DataField="User Name" HeaderText="Use rName" SortExpression= "UserName" />
<asp:BoundFie ld DataField="numo fguest" HeaderText="Num ber of Guests" SortExpression= "numofguest " />
<asp:BoundFie ld DataField="avat ar" HeaderText="ava tar" SortExpression= "avatar" >
</asp:BoundField>
</Columns>
<RowStyle BackColor="#FFF BD6" ForeColor="#333 333" />
<SelectedRowSty le BackColor="#FFC C66" Font-Bold="True" ForeColor="Navy " />
<PagerStyle BackColor="#FFC C66" ForeColor="#333 333" HorizontalAlign ="Center" />
<HeaderStyle BackColor="#990 000" Font-Bold="True" ForeColor="Whit e" />
<AlternatingRow Style BackColor="Whit e" />
</asp:GridView>
</code>
When I configure the SqlDatasource and test the query it actualy shows the Image in the TestQuery Results window. But when I run my page the Gridview populates with the other columns but in the AVATAR it shows byte[]
What should I do to get this working?
Been struggling with this little puzzle.
I am reading the MemberInfo table for the ClubStarterKit, the table includes the Avatar for the User.
I would like to display the Avatar as an image in a databound element, in this case I am resorting to Gridview although I would prefer datalist or something simpler.
<code>
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server" ConnectionStrin g="<%$ connectionStrin gs:ClubSiteDB %>"
SelectCommand=" SELECT aspnet_Users.Us erName, aspnet_Users.Us erId, Attendance.numo fguest, MemberInfo.avat ar FROM Attendance INNER JOIN aspnet_Users ON Attendance.memb er = aspnet_Users.Us erId INNER JOIN MemberInfo ON Attendance.memb er = MemberInfo.memb erid WHERE (Attendance.eve ntid = @id)">
<SelectParamete rs>
<asp:QueryStrin gParameter DefaultValue="1 " Name="id" QueryStringFiel d="EventId" Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
<asp:GridView ID="GridView1" runat="server" AllowPaging="Tr ue"
DataSourceID="S qlDataSource2" CellPadding="4" ForeColor="#333 333" GridLines="None " AutoGenerateCol umns="False" DataMember="Def aultView">
<FooterStyle BackColor="#990 000" Font-Bold="True" ForeColor="Whit e" />
<Columns>
<asp:BoundFie ld DataField="User Name" HeaderText="Use rName" SortExpression= "UserName" />
<asp:BoundFie ld DataField="numo fguest" HeaderText="Num ber of Guests" SortExpression= "numofguest " />
<asp:BoundFie ld DataField="avat ar" HeaderText="ava tar" SortExpression= "avatar" >
</asp:BoundField>
</Columns>
<RowStyle BackColor="#FFF BD6" ForeColor="#333 333" />
<SelectedRowSty le BackColor="#FFC C66" Font-Bold="True" ForeColor="Navy " />
<PagerStyle BackColor="#FFC C66" ForeColor="#333 333" HorizontalAlign ="Center" />
<HeaderStyle BackColor="#990 000" Font-Bold="True" ForeColor="Whit e" />
<AlternatingRow Style BackColor="Whit e" />
</asp:GridView>
</code>
When I configure the SqlDatasource and test the query it actualy shows the Image in the TestQuery Results window. But when I run my page the Gridview populates with the other columns but in the AVATAR it shows byte[]
What should I do to get this working?
Comment