Tag prefix

Discussion in 'ASP .Net' started by Blaz Ziherl, Nov 22, 2004.

  1. Blaz Ziherl

    Blaz Ziherl Guest

    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
     
    Blaz Ziherl, Nov 22, 2004
    #1
    1. Advertising

  2. What are u trying to do?
    Do u want to use ASP.NET or VB?


    "Blaz Ziherl" wrote:

    > 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
    >
     
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Nov 22, 2004
    #2
    1. Advertising

  3. 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



    "Blaz Ziherl" wrote:

    > 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
    >
     
    =?Utf-8?B?TWlrZUw=?=, Nov 22, 2004
    #3
  4. Blaz Ziherl

    Blaz Ziherl Guest

    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
     
    Blaz Ziherl, Nov 22, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. heidi

    Tag prefix and namespace

    heidi, Nov 2, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    356
    heidi
    Nov 2, 2003
  2. Roger Helliwell
    Replies:
    2
    Views:
    804
    Roger Helliwell
    Nov 22, 2004
  3. Tim Tyler
    Replies:
    36
    Views:
    1,467
    Darryl L. Pierce
    Dec 10, 2004
  4. shruds
    Replies:
    1
    Views:
    827
    John C. Bollinger
    Jan 27, 2006
  5. Chris  Chiasson
    Replies:
    6
    Views:
    622
    Richard Tobin
    Nov 14, 2006
Loading...

Share This Page