eutychus
  •  eutychus
  • 92% (Exalted)
  • YAF Lover Topic Starter
2014-09-25T19:24:22Z
Here's what I'm trying to do: I've had a website for a while which had it's own message board and a separate login system for the website. I'm trying YAF so I can have a single login and hopefully integrate the website and message board into a single unit. So, I've gotten YAF working and am now building the rest of the site around it.

Here's my current problem. I need to be able to show the avatar of a specific user on the front page of the site (which is not the YAF front page.) Knowing the user number, and being able to get the image data through an SQL statement, how do I convert the image data taken from the database into an image?
Sponsor
tha_watcha
2014-09-27T10:40:33Z
Well the easiest solution would be to use the api

YAF.Core.YafContext.Current.Get<IAvatars>().GetAvatarUrlForUser(this.UserId);


UserPostedImage
eutychus
  •  eutychus
  • 92% (Exalted)
  • YAF Lover Topic Starter
2014-09-27T17:27:40Z
That sounds like a plan! How do I impement that within an ASPX list view. Here's my code; the avatar should be where Image2 is.

 <asp:ListView ID="ListView2" runat="server" DataKeyNames="ID" DataSourceID="SQLComments">
                <ItemTemplate>
                    <h4><asp:Label ID="Label2" runat="server" Text='<%# oUtilities.reversetitle(Eval("title"), Eval("flip")) %>' /></h4>
                    <asp:Image ID="IMG_Short" runat="server" ImageUrl='<%# "iad_screenshots/" & Eval("releaseYear") & "/" & Eval("oldNumber") & "/" & Eval("commentScreenshot") & "thumb.jpg" %>' Visible='<%# getShortVisible(Eval("commentScreenshot")) %>'  />
                    <dl>
                        <dd>From <asp:Label ID="SubmitterLabel" runat="server" Text='<%# Eval("submitter") %>' />:
                            <asp:Label ID="CommentLabel" runat="server" Text='<%# trimComment(Eval("Comment")) %>' />
                            <asp:Image ID="Image2" runat="server" />
                        </dd>
                    </dl>
                    <br class="clearfix" />
                    <hr />
                </ItemTemplate>
                <EmptyDataTemplate></EmptyDataTemplate>
                <LayoutTemplate>
                    <div ID="itemPlaceholderContainer" runat="server">
                        <span ID="itemPlaceholder" runat="server" />
                    </div>
                </LayoutTemplate>
            </asp:ListView>
tha_watcha
2014-09-28T11:19:46Z
<asp:ListView ID="ListView2" runat="server" DataKeyNames="ID" DataSourceID="SQLComments">
               <ItemTemplate>
                   <h4><asp:Label ID="Label2" runat="server" Text='<%# oUtilities.reversetitle(Eval("title"), Eval("flip")) %>' /></h4>
                   <asp:Image ID="IMG_Short" runat="server" ImageUrl='<%# "iad_screenshots/" & Eval("releaseYear") & "/" & Eval("oldNumber") & "/" & Eval("commentScreenshot") & "thumb.jpg" %>' Visible='<%# getShortVisible(Eval("commentScreenshot")) %>'  />
                   <dl>
                       <dd>From <asp:Label ID="SubmitterLabel" runat="server" Text='<%# Eval("submitter") %>' />:
                           <asp:Label ID="CommentLabel" runat="server" Text='<%# trimComment(Eval("Comment")) %>' />
                           <asp:Image ID="Image2" runat="server" ImageUrl='<%# YAF.Core.YafContext.Current.Get<IAvatars>().GetAvatarUrlForUser(Eval("UserID")) %>' />
                       </dd>
                   </dl>
                   <br class="clearfix" />
                   <hr />
               </ItemTemplate>
               <EmptyDataTemplate></EmptyDataTemplate>
               <LayoutTemplate>
                   <div ID="itemPlaceholderContainer" runat="server">
                       <span ID="itemPlaceholder" runat="server" />
                   </div>
               </LayoutTemplate>
           </asp:ListView>

UserPostedImage
eutychus
  •  eutychus
  • 92% (Exalted)
  • YAF Lover Topic Starter
2014-09-29T15:40:20Z
Now I'm getting the error: Type parameter 'TService' for extension method 'Public Function Get(Of TService)() As TService' defined in 'YAF.Types.Interfaces.IServiceLocatorExtensions' cannot be inferred.
eutychus
  •  eutychus
  • 92% (Exalted)
  • YAF Lover Topic Starter
2014-10-05T13:00:40Z

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved