[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Two question about ASP.NET Custom Controls [Newbie]

DaBrain

10/27/2006 11:49:00 PM

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?

1 Answer

Michael Hamrah

10/29/2006 6:59:00 PM

0

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?