Two question about ASP.NET Custom Controls [Newbie]

Discussion in 'ASP .Net Building Controls' started by DaBrain, Oct 28, 2006.

  1. DaBrain

    DaBrain Guest

    1) I am developing custom controls and was wondering how I can
    implement the URL ~ deal.

    ~/page/page.aspx


    How do I translate ~ to the web root? I must be overlooking something
    very simple here?


    2) How do have something like this
    <aaa:control runat="server">STUFF HERE</aaa:control>


    How do I programmatically get "STUFF HERE", Where does it show at?

    Is it accessable?
     
    DaBrain, Oct 28, 2006
    #1
    1. Advertising

  2. 1) You can use the Page.ResolveClientUrl() property to properly parse
    the ~ character. The ~ essentially deails with virtual directories
    correctly.

    2) This can be done via the parsechildren attribute.

    Lets say you have a WebControl Demo with a property Text. To map the
    Inner Html of the markup to the text property you would specify:

    [ParseChildren(True, "Text")]
    public class Demo
    {
    public string Text
    {get; set; }
    }

    DaBrain wrote:
    > 1) I am developing custom controls and was wondering how I can
    > implement the URL ~ deal.
    >
    > ~/page/page.aspx
    >
    >
    > How do I translate ~ to the web root? I must be overlooking something
    > very simple here?
    >
    >
    > 2) How do have something like this
    > <aaa:control runat="server">STUFF HERE</aaa:control>
    >
    >
    > How do I programmatically get "STUFF HERE", Where does it show at?
    >
    > Is it accessable?
     
    Michael Hamrah, Oct 29, 2006
    #2
    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. Bob Rock
    Replies:
    1
    Views:
    664
    Cowboy \(Gregory A. Beamer\)
    Sep 17, 2006
  2. GenxLogic
    Replies:
    3
    Views:
    1,327
    andrewmcdonagh
    Dec 6, 2006
  3. rodchar
    Replies:
    0
    Views:
    398
    rodchar
    Nov 26, 2007
  4. John Richardson

    newbie question on Custom Controls in C#

    John Richardson, Feb 23, 2006, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    116
    John Richardson
    Feb 23, 2006
  5. Dejan Vesic
    Replies:
    0
    Views:
    178
    Dejan Vesic
    Aug 20, 2003
Loading...

Share This Page