Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > UserControl Properties

Reply
Thread Tools

UserControl Properties

 
 
=?Utf-8?B?Sm9u?=
Guest
Posts: n/a
 
      05-17-2005
Hello all,

I have a usercontrol with a number of public properties. A couple of these
properties are file paths (to xml files, etc). These file paths may be to any
folder in my project.

However, when setting these using xmlfile="~/thexmlfile.xml" it doesn't seem
to work. If I do a debug at the point is does the set, is coming through as
"~/thexmlfile.xml" rather than the actual application path. Why is this and
is there a work around? I've also tried doing a contect swith to a method
that would return the application path, eg
xmlfile="<%=MyAppPathMethod%>/thexmlfle.xml", but alas this didn't wotk.

Any help, would be much appreciated,

Jon
 
Reply With Quote
 
 
 
 
William F. Robertson, Jr.
Guest
Posts: n/a
 
      05-17-2005
You should use Server.MapPath.

string XmlFile = Server.MapPath( "~/thexmlfile.xml" ).

it will get the actual path on your server.

HTH,

bill

"Jon" <> wrote in message
news:93757229-C3F5-4D34-B797-...
> Hello all,
>
> I have a usercontrol with a number of public properties. A couple of these
> properties are file paths (to xml files, etc). These file paths may be to

any
> folder in my project.
>
> However, when setting these using xmlfile="~/thexmlfile.xml" it doesn't

seem
> to work. If I do a debug at the point is does the set, is coming through

as
> "~/thexmlfile.xml" rather than the actual application path. Why is this

and
> is there a work around? I've also tried doing a contect swith to a method
> that would return the application path, eg
> xmlfile="<%=MyAppPathMethod%>/thexmlfle.xml", but alas this didn't wotk.
>
> Any help, would be much appreciated,
>
> Jon



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a property of a control inside a usercontrol, from another usercontrol Fabiano ASP .Net 2 06-03-2005 09:56 AM
accessing usercontrol from another usercontrol Phl ASP .Net 2 11-18-2004 07:33 PM
Access a control inside an usercontrol from another control inside another usercontrol nail ASP .Net 0 09-15-2004 03:55 PM
Can we use a usercontrol inside a usercontrol Rajesh Tiwari ASP .Net 0 08-12-2003 03:56 PM
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack huobazi ASP .Net 1 07-03-2003 03:14 AM



Advertisments