Programmatically specify multiple 'ControlsToSkip'

2 posts, 0 answers
  1. mqsash
    mqsash avatar
    31 posts
    Member since:
    May 2012

    Posted 30 Aug 2013 Link to this post

    I need to create a RadFormDecorator on the fly and add it to my page.
    The FormDecorator also needs to skip a few types of controls for which I am using the ControlsToSkip property.
    My code is as shown below

    Dimfd = NewTelerik.Web.UI.RadFormDecorator()

    fd.ID = "FormDecorator1"

    fd.Skin = CStr(Session("SelectedSkin"))

     

    fd.DecoratedControls = Telerik.Web.UI.FormDecoratorDecoratedControls.All

    fd.ControlsToSkip = FormDecoratorDecoratedControls.Textbox

    fd.ControlsToSkip = FormDecoratorDecoratedControls.Label

     

    Form.Controls.Add(fd)



    Now when I do this the fd.ControlsToSkip is only as good as the last control that is assigned to it. In the above scenario, when the form decorator gets added to the form, the controlsToSkip only contains the Label and not the TextBox.

    When creating a formdecorator using the html markup we can specify multiple controls to skip using comma separated values, I was wondering how it can be done programmatically as well?

    Thanks

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 30 Aug 2013 Link to this post

    Hello,

    I have just answered your support ticket on the matter and I am adding the information here for anyone else that may have a similar question:



    Since this property is an enumerator you can use a logical OR to add values; having subsequent setters for the same property should be expected to leave only the last value:
    RadFormDecorator1.ControlsToSkip = FormDecoratorDecoratedControls.Textbox Or FormDecoratorDecoratedControls.Label


    Regards,
    Marin Bratanov
    Telerik
    Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top