Two question about ASP.NET Custom Controls [Newbie]

D

DaBrain

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?
 
M

Michael Hamrah

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; }
}
 

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

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top