More in this section
Forums / Developing with Sitefinity / XML Literals and Module development?

XML Literals and Module development?

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Seeker
    Seeker avatar
    1 posts
    26 May 2008
    19 Nov 2009
    Link to this post



    I would like to know what are the advantages and shortcomings (if any) of using XML literals to programmatically add controls to module views. Am i required to use layout template (.ascx) files. Or can i use this approach?


    I come from the winforms programming background, and its more natural for me to do everything programmatically.


    This is a sample i did, and it seems to work fine:

     Protected Overloads Overrides Sub InitializeControls(ByVal viewContainer As System.Web.UI.Control)  
            Dim Textbox As New TextBox  
            Textbox.Text = "Testing..." 
            Dim Html = <span style="color: green;"><%= Textbox.Text %></span>  
            Dim HtmlContainer As New LiteralControl(Html.ToString)  
        End Sub 


    Thank you.

  2. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
    20 Nov 2009
    Link to this post
    Hello Seeker,

    It is really up to you which approach you will take. 
    The user controls will give you the ability to have more separate units, and possibly the option to reuse them. This could save a lot of work. You can also open them in Design View in Visual Studio. Another plus is separating the presentation logic (ascx) from the business logic and code (.cs).

    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