Advertisement
Guest User

Untitled

a guest
May 31st, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. <div class="box box-primary">
  2. <div class="box-header with-border">
  3. <h3 class="box-title">
  4. <asp:Literal ID="litTitulo" runat="server"></asp:Literal>
  5. </h3>
  6. <div class="box-tools pull-right">
  7. <button data-widget="collapse" class="btn btn-box-tool"><i class="fa fa-minus"></i></button>
  8. </div>
  9. </div>
  10. <!-- /.box-header -->
  11. <div class="box-body">
  12. <asp:PlaceHolder ID="PlaceHolder1" runat="server">
  13. </asp:PlaceHolder>
  14. </div>
  15.  
  16. Imports System.ComponentModel
  17.  
  18. <TemplateContainer(GetType(MyTemplateContainer))> _
  19. <TemplateInstance(TemplateInstance.Single)> _
  20. <PersistenceMode(PersistenceMode.InnerProperty)> _
  21. <Browsable(True)> _
  22. <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
  23. Public Property ContentTemplate() As ITemplate
  24. Get
  25. Return m_ContentTemplate
  26. End Get
  27. Set(value As ITemplate)
  28. m_ContentTemplate = value
  29. End Set
  30. End Property
  31. Private m_ContentTemplate As ITemplate
  32.  
  33. Private m_titulo As String
  34. Public Property TituloBox As String
  35. Get
  36. Return m_titulo
  37. End Get
  38. Set(value As String)
  39. m_titulo = value
  40. End Set
  41. End Property
  42.  
  43.  
  44. Protected Sub Page_Load(sender As Object, e As EventArgs)
  45.  
  46. End Sub
  47. Protected Sub Page_Init(sender As Object, e As EventArgs)
  48. Me.PlaceHolder1.Controls.Clear()
  49. End Sub
  50. Protected Overrides Sub CreateChildControls()
  51.  
  52. If Me.ContentTemplate IsNot Nothing Then
  53. Dim container = New MyTemplateContainer()
  54. litTitulo.Text = m_titulo
  55. Me.ContentTemplate.InstantiateIn(container)
  56. Me.PlaceHolder1.Controls.Add(container)
  57. Else
  58. Me.PlaceHolder1.Controls.Add(New LiteralControl("No hay contenido"))
  59. End If
  60. End Sub
  61. Public Overrides Sub DataBind()
  62. Me.CreateChildControls()
  63. Me.ChildControlsCreated = True
  64. MyBase.DataBind()
  65. End Sub
  66.  
  67. <asp:FormView ID="fvEmpresa" runat="server" RenderOuterTable="false">
  68. <EmptyDataTemplate>
  69. <p>NO HAY DATOS</p>
  70. </EmptyDataTemplate>
  71. <EditItemTemplate>
  72. <div class="row">
  73. <uc1:UCBSBoxPrimary runat="server" ID="mybox1" TituloBox="Titulollo">
  74. <ContentTemplate>
  75. <p>Contenido</p>
  76. </ContentTemplate>
  77. </uc1:UCBSBoxPrimary>
  78. </div>
  79. </EditItemTemplate>
  80.  
  81. </asp:FormView>
  82.  
  83. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  84. 'cargar el templatedcontrol
  85. Dim mybox As UCBSBoxPrimary = CType(CUtilLocal.FindControlByID(fvEmpresa, "mybox1"), UCBSBoxPrimary)
  86. If (Not IsNothing(mybox)) Then
  87. mybox.TituloBox = "titulillo"
  88. End If
  89. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement