+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Email Field in the Wiki

Email Field in the Wiki

2 posts, 0 answered
  1. Drew Peloubet
    Drew Peloubet avatar
    10 posts
    Registered:
    06 Oct 2008
    22 Oct 2009
    Link to this post
    There are 5 tabs on a wiki page:  content, edit, comments, history, & search.  The comments tab provides a free form entry field, Name field, email field, & url field.  What is the email field used for?  How does the name field get populated?  If this is coming from a user profile, why isn't email field being populated from the user profile?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    27 Oct 2009
    Link to this post
    Hello Drew Peloubet,

    The name of the user is set automatically using Context.User.Identity.Name. This is done internally in WikiCommentsList class.

    You can extend the WikiCommentsList class and implement functionality that will set the other fields from the form.

    Sample code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Wiki.WebControls;
    using System.Web.UI;
    using Telerik.Security;
    using System.Web.Security;
     
    /// <summary>
    /// Summary description for WikiCommentsListCustom
    /// </summary>
    ///
     
    namespace Telerik.Samples1
    {
        public class WikiCommentsListCustom : WikiCommentsList
        {
            public WikiCommentsListCustom()
            {
     
            }
     
            public override string LayoutTemplatePath
            {
                get
                {
                    return "~/Sitefinity/Admin/ControlTemplates/Wiki/WikiCommentsList.ascx";
                }
            }
     
            protected override void InitializeControls(System.Web.UI.Control controlContainer)
            {
                base.InitializeControls(controlContainer);
                bool flag = false;
                if (this.Context.User.Identity.IsAuthenticated)
                {
                    MembershipUser user = Membership.GetUser(Context.User.Identity.Name);
                    emailTxt.Text = user.Email;
                    flag = true;
                }
            }
     
            protected virtual ITextControl emailTxt
            {
                get
                {
                    return base.Container.GetControl<ITextControl>("emailTxt", true);
                }
            }
        }
    }

    Then you need to add the newly created control in Sitefinity\ControlTemplates\Wiki\WikiViewSingleItem.ascx

    1. Map the template using WikiView SingleItemTemplatePath property.
    2. Replace the default control with our custom one.

    <%@ Register TagPrefix="cc" Assembly="App_Code" Namespace="Telerik.Samples1" %>
     
    ....
        ....
          ....
     
    <div id="comments" class="sf_contentComments">
                <cc:WikiCommentsListCustom ID="commentsList" runat="server" CssClass="sf_commentsList" ValidationGroup="commentInfo">
                </cc:WikiCommentsListCustom>
            </div>


    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered