【问题标题】:Membership profiles in repeater中继器中的会员资料
【发布时间】:2012-10-26 14:40:03
【问题描述】:

前端

<asp:Repeater ID="rpt_comments" runat="server" DataSourceID="sqldata_rpt_comments" OnLoad="rpt_comments_Load">
  <ItemTemplate>
    <div class="comments">
      <div class="news-comment-left">
          <asp:Image ID="imgCommentAvatar" Width="50px" Height="50px" runat="server" />
      </div>
      <div class="news-comment-right">
          <asp:Label ID="lblCommentProfile" runat="server"></asp:Label>
          <asp:Label ID="lblCommentAuthor" runat="server" Text='<%#Eval ("CommentsAuthor") %>' Visible="false"></asp:Label>
          <div style="float: right;"><%#Eval ("CommentsDate", "{0:dd.MM.yyyy}") %></div>
          <br />
          <%#Eval ("Comment") %><br />
      </div>
      <br />
      <br />
      <br />
      <br />
    </div>
  </ItemTemplate>
</asp:Repeater>

后台

public void commentsprofiles()
{
    Label CommentAuthor = (Label)Tools.FindControlRecursive(rpt_comments, "lblCommentAuthor");
    Label CommentProfile = (Label)Tools.FindControlRecursive(rpt_comments, "lblCommentProfile");
    Image imgCommentAvatar = (Image)Tools.FindControlRecursive(rpt_comments, "imgCommentAvatar");

    ProfileCommon userProfile = Profile.GetProfile(CommentAuthor.Text);

    imgCommentAvatar.ImageUrl = userProfile.Avatar;
    CommentProfile.Text = userProfile.NickName;
}
protected void rpt_comments_Load(object sender, EventArgs e)
{
    commentsprofiles();
}

如您所见,我正在尝试使用 FindControlRecursive 检索中继器中的控件,当我提取控件并想知道其中的内容时,我在 asp.net Membership 中获得了配置文件,它也有效,但仅适用于我的转发器中的 1 个重复项,所以我需要帮助如何编码,以便它不断重复每个 CommentAuthor 的配置文件。

【问题讨论】:

    标签: c# asp.net membership backend profiles


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 2011-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多