More in this section

Forums / Developing with Sitefinity / IList with controls of a page

IList with controls of a page

2 posts, 0 answered
  1. Ricardo Marcelino
    Ricardo Marcelino avatar
    15 posts
    Registered:
    04 Nov 2009
    03 Dec 2009
    Link to this post
    Hello!

    I need to check if my page already has controls with certain ID values. I've got:
    IList<ICmsWebControl> listControls = page.Staged.Controls; 
    foreach (ICmsWebControl item in listControls) 
    {                             
        StreamWriter cWriter = new StreamWriter(@"c:\log\log_events.txt"true, Encoding.GetEncoding("iso-8859-1")); 
        cWriter.WriteLine(item.ID); 
        cWriter.Flush(); 
        cWriter.Close(); 

    But item.ID returns the unique id of each control, and i want to know the value of the ID (programmatic name).

    How can i access it?

    Thanks in advance,
    Ricardo Marcelino
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    04 Dec 2009
    Link to this post
    Hello Ricardo Marcelino,

    You can use TypeName. There is no public property from which to get the value of the control.

    All the best,
    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