473,385 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

UserControl Properties

Jon
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
Nov 19 '05 #1
1 1194
You should use Server.MapPath.

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

it will get the actual path on your server.

HTH,

bill

"Jon" <Jo*@discussions.microsoft.com> wrote in message
news:93**********************************@microsof t.com...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: james | last post by:
I cannot get my UserControl's browsable properties to show up in the designer properties panel. I have then public virtual bool TestProp { {get return testProp; } set { testProp = value; } } ...
4
by: Mark Friedman | last post by:
I can't seem to figure out how to get a reference to a UserControl in the code-behind for the page that contains the control. All the examples I've seen show how to pass property values from the...
2
by: Eric Maia | last post by:
I have two UserControls I am using in a form. These are each also used separately in two other forms. The structure is essentially this: CourseUserControl.ascx - select or enter a course...
5
by: Sylvain Barde | last post by:
Wanna make a usercontrol that when seen from properties window has a "plus" sign at left that indicate some members of a property. Like the property Size of a form. Or like a collection like...
3
by: Don | last post by:
I've created a custom UserControlwithin which I have placed a Panel. I've changed the Panel's "Modifier" property to Public so that it appears in the Properties Window of the UserControl. This...
2
by: Meelis Lilbok | last post by:
Hi How to create "Wizard" for user control? For example i have usercontrol with properties. To make easier for seting those properties i wan't to create a wizrd, that helps user complete and...
2
by: gerry | last post by:
based on MSPress's ASP.NET 2.0 Applications Advaced Topics ( Table 12-3 p.472 ), and most events should be automatically wired up when @Control AutoEventWireup="true". ie. Page_InitComplete() {}...
6
by: MeowCow | last post by:
I have created a UserControl that encapsulates a third party data grid. My goal was to create my own DataSource and DataMember properties that forward the binding to the third party grid, then use...
10
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's...
2
by: she_prog | last post by:
I have a class derived from UserControl. I need to serialize an object of this class, but only some properties of it, as not all properties are serializable (some of the properties coming from...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.