Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="box box-primary">
- <div class="box-header with-border">
- <h3 class="box-title">
- <asp:Literal ID="litTitulo" runat="server"></asp:Literal>
- </h3>
- <div class="box-tools pull-right">
- <button data-widget="collapse" class="btn btn-box-tool"><i class="fa fa-minus"></i></button>
- </div>
- </div>
- <!-- /.box-header -->
- <div class="box-body">
- <asp:PlaceHolder ID="PlaceHolder1" runat="server">
- </asp:PlaceHolder>
- </div>
- Imports System.ComponentModel
- <TemplateContainer(GetType(MyTemplateContainer))> _
- <TemplateInstance(TemplateInstance.Single)> _
- <PersistenceMode(PersistenceMode.InnerProperty)> _
- <Browsable(True)> _
- <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
- Public Property ContentTemplate() As ITemplate
- Get
- Return m_ContentTemplate
- End Get
- Set(value As ITemplate)
- m_ContentTemplate = value
- End Set
- End Property
- Private m_ContentTemplate As ITemplate
- Private m_titulo As String
- Public Property TituloBox As String
- Get
- Return m_titulo
- End Get
- Set(value As String)
- m_titulo = value
- End Set
- End Property
- Protected Sub Page_Load(sender As Object, e As EventArgs)
- End Sub
- Protected Sub Page_Init(sender As Object, e As EventArgs)
- Me.PlaceHolder1.Controls.Clear()
- End Sub
- Protected Overrides Sub CreateChildControls()
- If Me.ContentTemplate IsNot Nothing Then
- Dim container = New MyTemplateContainer()
- litTitulo.Text = m_titulo
- Me.ContentTemplate.InstantiateIn(container)
- Me.PlaceHolder1.Controls.Add(container)
- Else
- Me.PlaceHolder1.Controls.Add(New LiteralControl("No hay contenido"))
- End If
- End Sub
- Public Overrides Sub DataBind()
- Me.CreateChildControls()
- Me.ChildControlsCreated = True
- MyBase.DataBind()
- End Sub
- <asp:FormView ID="fvEmpresa" runat="server" RenderOuterTable="false">
- <EmptyDataTemplate>
- <p>NO HAY DATOS</p>
- </EmptyDataTemplate>
- <EditItemTemplate>
- <div class="row">
- <uc1:UCBSBoxPrimary runat="server" ID="mybox1" TituloBox="Titulollo">
- <ContentTemplate>
- <p>Contenido</p>
- </ContentTemplate>
- </uc1:UCBSBoxPrimary>
- </div>
- </EditItemTemplate>
- </asp:FormView>
- Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- 'cargar el templatedcontrol
- Dim mybox As UCBSBoxPrimary = CType(CUtilLocal.FindControlByID(fvEmpresa, "mybox1"), UCBSBoxPrimary)
- If (Not IsNothing(mybox)) Then
- mybox.TituloBox = "titulillo"
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement