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

Forums / Developing with Sitefinity / Unique Id of the edit control

Unique Id of the edit control

4 posts, 0 answered
  1. Frederico Fernandes
    Frederico Fernandes avatar
    29 posts
    Registered:
    27 Oct 2009
    30 Dec 2009
    Link to this post
    hi,
    I want to know how i get the UniqueId of the control in edit mode on administrative parte -> edit page
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    30 Dec 2009
    Link to this post
    Hello Frederico Fernandes,

    You can try the following code that gets the first control from the collection

    ICmsUrlContext currentPage = (ICmsUrlContext)this.Context.Items[Telerik.Cms.Web.UrlHelper.CmsPageKey];
    Guid pageID = currentPage.PageID;
    var manager = new CmsManager();
    ICmsPage page = manager.GetPage(pageID, true) as ICmsPage;
    int number = page.Controls.Count;
    ICmsWebControl c = page.Controls[0];
    Guid cntrolID = c.ID;

    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.
  3. Frederico Fernandes
    Frederico Fernandes avatar
    29 posts
    Registered:
    27 Oct 2009
    30 Dec 2009
    Link to this post
    hi Ivan,

    that is not what i really want, because i have many contros and i just want the control i´m editing in edit mode.

    but tanks anyway.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    30 Dec 2009
    Link to this post
    Hello Frederico Fernandes,

    Create a aspx page that inherits from Telerik.Cms.Web.CmsPageBase with the following content.

    <%@ Register Assembly="Telerik.Cms" Namespace="Telerik.Cms.Web.UI" TagPrefix="cc1" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml" id="noscroll">
    <head runat="server">
        <title>GetID</title>
        
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
            <cc1:ControlEditor ID="ControlEditor1" runat="server">
            </cc1:ControlEditor>
        </div>
        </form>
    </body>
    </html>



    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
     
    public partial class TestPage : Telerik.Cms.Web.CmsPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && !String.IsNullOrEmpty(Request.QueryString["sfctrlid"]))
            {
                 
                string ids = Request.QueryString["sfctrlid"].ToString();
                 
            }
     
        }
    }

    Sincerely yours,
    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.
Register for webinar
4 posts, 0 answered