Tag prefix

B

Blaz Ziherl

Hi all,

I have two ASP.NET newby questions:

1. what and why are there tag prefixes (example <asp:....)?
2. why doesn't the following code (in VB.NET) render these prefixes?

Dim myTextBox As New System.Web.UI.WebControls.TextBox
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

myTextBox.RenderControl(oHtmlTextWriter)
TextBox1.Text = oStringWriter.ToString()


Regards,
Blaz
 
G

Guest

blaz,

Tag prefixes are used by the asp.net compiler to identify tags that should
be processed on the server. All stardard ASP.Net control have the ASP
prefix. If you build your own controls, you can use a custom tag prefix such
as:

<blaz:newlabel id="blazlabel1" runat="server" text="" />

If you notice the rendered HTML output on the client these server controls
have been rendered as standard HTML elements such as <select>, <input>,
<img>, and so forth. Browsers such as IE and Netscape cannot parse a
<asp:label> tag, the server handles this.

For the answer to question 2. What are you trying to do?

Add a text box to a form?
Dim tbFirstName as System.Web.UI.WebControls.TextBox
Page.Controls.Add(FirstName)
Read the text of a textbox?
Dim strFirstName as String = tbFirstName.Text

HTH MikeL
 
B

Blaz Ziherl

Thanks for your answers!

About the rendering. Well I am trying to add an ASP.NET WebControls
support to my application that includes a simple HTML Editor. But
can't really figure out how could I generate <asp:...></asp:...>
formatted ASP code from any of the WebControls.

Any ideas?

Regards,
Blaz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top