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

Forums / Developing with Sitefinity / Getting GUID In Control Designer

Getting GUID In Control Designer

2 posts, 0 answered
  1. Jeff
    Jeff avatar
    9 posts
    Registered:
    29 Nov 2009
    28 Jul 2010
    Link to this post
    I am attempting to create a Control Designer that will store data in an external table with the primary key being some unique indentifier for that control on that particular page.  For example, I will place one of these controls on each page and each will show different data.  The control designer allows you to manipulate the data associated with that instance of the control.

    I tried searching CmsPageBase.Controls[] to find my control and then get its ID (which is a GUID).  But this only works on the front end, not when in the control designer.

    How can I get a key that is unique to the control being edited that is known when editing its properties in a Control Designer and will also be known when the control renders itself on the front end of the site?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    28 Jul 2010
    Link to this post
    Hello Jeff Dease,

    The control renders with its ClientID, since the control has another unique ID that is stored in the database. For each page version this unique ID is different when versioning for pages is enabled. You should better create a new property which generates a random number and access this property from your control. When you call OnSaving() method of your custom dialog you can persist this property in your custom table. When the control is rendered on a page you can get this control from controls collection and read the property.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered