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

Forums / General Discussions / Blog Problem

Blog Problem

4 posts, 0 answered
  1. praba karan
    praba karan avatar
    11 posts
    Registered:
    04 Aug 2009
    17 Aug 2009
    Link to this post
    hi,
    1. This is my code:
     string CurrentCategory = postContent.GetMetaData("Category").ToString();
     Category.Text = CurrentCategory;

      <sf:ContentCategoriesField ID="Category" runat="server" ProviderName="Blogs" >
      </sf:ContentCategoriesField>

    I got value from getmetadata method. but when assign it shows empty value. But Category value came in CurrentCategory.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Aug 2009
    Link to this post
    Hi praba karan,

    If you add the logic to button click event you can set the text value of ContentCategoriesFiled control.

     void btn1_Click(object sender, EventArgs e) 
        { 
            this.CategoriesField.Text = CurrentCategorty; 
        } 

    If your approach is different, please let us know.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. praba karan
    praba karan avatar
    11 posts
    Registered:
    04 Aug 2009
    17 Aug 2009
    Link to this post
    Hi,
    My approach is Different.
    i want to edit comment.
    when page load event i am getting all the values for a particluar CommentId. I am getting Catergory Value using getmetadate method,
    But i am unable to assign value to catagories control.

    page-load event()
    {
    string CurrentCategory = postContent.GetMetaData("Category").ToString();
     Category.Text = CurrentCategory;
    }

    It shows Category.Text is empty..How i assign category value to ContentCategoriesField.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Aug 2009
    Link to this post
    Hello praba karan,

    It is not possible to use a user control and set the text on Page_Load event because ContentCategoriesfield control inherits from SimpleControl where we call  this.Controls.Clear(); and then InitializeControls. The solution is creating a custom control as the example below illustrates.

    public class customCategoriesfieldControl : ContentCategoriesField 
        public customCategoriesfieldControl() 
        { 
        } 
        public override string LayoutTemplatePath 
        { 
            get 
            { 
                return "~/Sitefinity/Admin/ControlTemplates/Generic_Content/CategoriesField.ascx"
            } 
        } 
     
        protected override void InitializeControls(System.Web.UI.Control controlContainer) 
        { 
            base.InitializeControls(controlContainer); 
            CategoriesList.SelectedItem.Text = "some text or metadata here"
        } 


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered