nju0843
Member
Hello All!
I was wondering if you knew of a way to allow nesting of
a webcontrol inside of the custom control I am creating.
For instance...
For the html above the two ASP tags get stripped out when
parsed...
The html below gets parsed and displayed to the page perfectly.
For some reason the asp tags get parsed differently and it does not
get handled...I would like to know
1) Why this happens...
2) Is there a solution for it?
All of the code for my CustomControl is posted below...
Thanks so much for your help...
-nju0843
I was wondering if you knew of a way to allow nesting of
a webcontrol inside of the custom control I am creating.
For instance...
HTML:
<cc1:ControlFrame>
<asp:Label text="Keyword 1:"/>
<asp:TextBox id="txtKeyword1" runat="server"/>
</cc1:ControlFrame>
parsed...
The html below gets parsed and displayed to the page perfectly.
HTML:
<cc1:ControlFrame>
<span>Keyword 1:</span>
<input id="txtKeyword1" type="text">
</cc1:ControlFrame>
get handled...I would like to know
1) Why this happens...
2) Is there a solution for it?
All of the code for my CustomControl is posted below...
VB.NET:
Imports System.ComponentModel
Imports System.Web.UI
Public Class MyControlBuilder
Inherits ControlBuilder
Public _parser As System.Web.UI.TemplateParser
Public _parentBuilder As System.Web.UI.ControlBuilder
Public _type As System.Type
Public _tagName As System.String
Public _id As System.String
Public _attribs As System.Collections.IDictionary
Public Overrides Sub Init(ByVal parser As System.Web.UI.TemplateParser, ByVal parentBuilder As System.Web.UI.ControlBuilder, ByVal type As System.Type, ByVal tagName As System.String, ByVal id As System.String, ByVal attribs As System.Collections.IDictionary)
_parser = parser
_parentBuilder = parentBuilder
_type = type
_tagName = tagName
_id = id
_attribs = attribs
End Sub
Public Overrides Sub AppendLiteralString(ByVal s As String)
s = s.Trim
_attribs("Text") = s
MyBase.Init(_parser, _parentBuilder, _type, _tagName, _id, _attribs)
End Sub
End Class
<DefaultProperty("Text"), _
PersistChildren(True), _
ControlBuilderAttribute(GetType(MyControlBuilder)), _
ParseChildren(False), _
ToolboxData("<{0}:MyDirectoryFrames runat=server></{0}:MyDirectoryFrames>")> _
Public Class MyDirectoryFrames
Inherits System.Web.UI.WebControls.WebControl
Dim _text As String
Dim _title As String
Dim _InnerHtml As String
<Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String
Get
Return _text
End Get
Set(ByVal Value As String)
_text = Value
End Set
End Property
<Bindable(False), Category(), DefaultValue("")> Property [Title]() As String
Get
Return _title
End Get
Set(ByVal Value As String)
_title = Value
End Set
End Property
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
output.WriteLine("<table class=""sTableInner"" id=""tdheader"">")
output.WriteLine(" <tr>")
output.WriteLine(" <td class=""sTableTopLeft""><img src=""http://localhost/My_Directory/my_images/mycontrols/spacer.gif"" height=""7"" width=""7""></td>")
output.WriteLine(" <td class=""sTableTopMid"" width=""100%""></td>")
output.WriteLine(" <td class=""sTableTopRight""><img src=""http://localhost/my_Directory/my_images/mycontrols/spacer.gif"" height=""7"" width=""7""></td>")
output.WriteLine(" </tr>")
output.WriteLine(" <tr>")
output.WriteLine(" <td class=""sTableMidLeft""></td>")
output.WriteLine(" <td class=""sTableMid"">")
output.WriteLine(" <table width=""100%"">")
output.WriteLine(" <tr class=""sGridColumnHeader"">")
output.WriteLine(" <td width=""100%"" onclick=""javascript:toggleSearch();"">" + [Title] + "</td>")
output.WriteLine(" </tr>")
output.WriteLine(" </table>")
output.WriteLine(" </td>")
output.WriteLine(" <td class=""sTableMidRight""></td>")
output.WriteLine(" </tr>")
output.WriteLine(" <tr height=""100%"" valign=""top"">")
output.WriteLine(" <td class=""wTableMidLeft""></td>")
output.WriteLine(" <td class=""wTableMid"">")
output.Write([Text])
output.WriteLine(" </td>")
output.WriteLine(" <td class=""wTableMidRight""></td>")
output.WriteLine(" </tr>")
output.WriteLine(" <tr>")
output.WriteLine(" <td class=""wTableBottomLeft""><img src=""http://localhost/my_Directory/my_images/mycontrols/spacer.gif"" height=""7"" width=""7""></td>")
output.WriteLine(" <td class=""wTableBottomMid""></td>")
output.WriteLine(" <td class=""wTableBottomRight""><img src=""http://localhost/my_Directory/my_images/mycontrols/spacer.gif"" height=""7"" width=""7""></td>")
output.WriteLine(" </tr>")
output.WriteLine("</table>")
End Sub
End Class
-nju0843