writing a custom tag

lamy

Regular
Joined
Dec 12, 2005
Messages
56
Location
under your bed
i have sets of tags that i wanted to write in my html (specifying where it should be) but i couldnt find the right approach for this

atm i made a web control which serves as a place holder, then on my page i find (if its on a master page) the control and assign the content (in a property) while the control (placeholder) overides Render so it gets written to where i placed it

any other way to do this? all i wanted to do is write some custom tags like these

<html>
<form ...>
...
</form>

<mycustomtag value="set" target="something"/>
<mycustomtag value="invoke" target="something_else"/>
<mycustomtag value="invoke" target="another"/>
<mycustomtag value="terminate" target="true"/>
</html>

it has no order or whatsoever, itll depend on the conditions that i made.

if youre wondering why i needed this its because this page is being read by my winforms application which actually handles the interface (its for a kiosk, the ui for keypads and all those are done in windows control which i invoke if i see those tags)

response.write wont do since i cant tell it where to write it, thats why i made that placeholder so i know where i put it, anyone?

heres what i have atm

my tag writer control
Visual Basic:
<ToolboxData("<{0}:TagWriter runat=""server""></{0}:TagWriter>")> _
Partial Class TagWriter
    Inherits System.Web.UI.UserControl

    Private _Content As String = String.Empty

    <Personalizable()> _
    Public Property Content() As String
        Get
            Return _Content
        End Get
        Set(ByVal value As String)
            _Content = value
        End Set
    End Property

    Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
        writer.Write(_Content)
    End Sub
End Class

at code-behind i generate those tags using a class (function returning a string) and assign it to content

from my page (load)
Visual Basic:
TagWriter1.Content = "something here"

if its on a master page
Visual Basic:
Dim tag As TagWriter = CType(Page.Master.FindControl("tagWriter"), TagWriter)
tag.Content = "something here"
 
Last edited:
Back
Top