Programmatically add and change controls

Page 2 of 2 FirstFirst 12
  1. #11

    RE: Programmatically add and change controls



    Quick update... the PostBack issues with the Window control have been fixed. The new code is available with the version 0.4.0 release (or higher). Download.

    Hope this helps.
    Geoffrey McGill
    Founder
  2. #12

    RE: Programmatically add and change controls

    hi geoffrey,

    I try to implement your code on the Tab to add the control dinamically from code behind.
    It's only show text "test" and not the control.

    Am I miss some code here?

    Dim myTabPanel As New Coolite.Web.UI.TabPanel
    
    Dim myTab As New Tab
    
     Dim cal As Calendar = New Calendar
    cal.SelectedDate = Now
    
    myTab.ContentContainer.Controls.Add(cal)
    myTab
    myTab.Title = "Tab1"
    myTab.Html = "<div style=\'text-align: center;\'>test
    "
    
    myTabPanel.Items.Add(myTab)
    PlaceHolder1.Controls.Add(myTabPanel)
  3. #13

    RE: Programmatically add and change controls

    Hi erw13n,

    If the .Html property has been set it will override anything that has been added to the ContentContainer collection.

    Adding the raw text as a LiteralControl should work.

    Example

    Dim myTabPanel As New Coolite.Web.UI.TabPanel
    
    Dim myTab As New Tab
    myTab.Title = "Tab1"
    
    Dim cal As Calendar = New Calendar
    cal.SelectedDate = Now
    
    myTab.ContentContainer.Controls.Add(cal)
    
    Dim html as LiteralControl = new LiteralControl("<div style=\'text-align: center;\'>test
    ")
    myTab.ContentContainer.Controls.Add(html)
    
    myTabPanel.Items.Add(myTab)
    
    
    PlaceHolder1.Controls.Add(myTabPanel)
    Hope this helps.


    Geoffrey McGill
    Founder
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 5
    Last Post: Jul 29, 2016, 7:54 AM
  2. [CLOSED] Programmatically change root text in Treepanel control
    By ewgoforth in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 22, 2010, 11:07 PM
  3. Replies: 0
    Last Post: Oct 17, 2010, 3:20 PM
  4. Replies: 0
    Last Post: Sep 22, 2010, 10:43 AM
  5. Replies: 1
    Last Post: Apr 15, 2010, 2:29 AM

Posting Permissions