Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

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

<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)

TagWriter1.Content = "something here"

 

if its on a master page

Dim tag As TagWriter = CType(Page.Master.FindControl("tagWriter"), TagWriter)
tag.Content = "something here"

Edited by lamy

slow down when you need to hurry, stop when you need to move on,

look back when you need to forget, or you might slip and leave sanity

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...