how to get the path of page which contain the custom control?

When I drag a custom control onto aspx page, I have written a UIEditor class to edit property of my custom control, but how to get the path of aspx when I open the UIEditor form?

I have tried many ways, but still have no idea.  Please help me...

0
dnyz
5/4/2005 5:08:27 AM
asp.net.hosting-open-forum 4216 articles. 0 followers. Follow

1 Replies
588 Views

Similar Articles

[PageSpeed] 23

If you mean "UITypeEditor" class, it is designed to be used only from the Properties Editor. The design mode application (VS.NET, WebMatrix, etc) locates the correct type from the [Editor()] attribute associated with a specific property. The PropertiesEditor uses that UITypeEditor object to build the UI and already has an instance of the web control which is passed in as the value parameter in the EditValue method. Your editor's job is to modify the object instance (change a property). This system doesn't require any info about the page, just the object.

As for getting a path to the page in design mode for other reasons, ASP.NET 1.x does not allow that. I know. I tried and finally developed a tool to do this that is free and available on my website (ASP.NET Design Mode Extender).

I've been exploring ASP.NET 2.0 over the last few days and have found they have given us some access to this info. There is a new class, IWebApplication that you get as a service. It's properties give you access to the file path of the web application, the project and more. It has a method to open the web config file. I can't wait to use it!

IWebApplication vWA = (IWebApplication) ControlInstance.Page.Site.GetService(typeof(IWebApplication));
vWA.RootProjectItem.PhysicalPath may be what you want. Also vWA.OpenWebConfiguration() and vWA.GetProjectItemFromUrl() will give you interesting info. Since its not documented yet, I recommend using the debugger and seeing what values it contains as you debug a design mode session.


--- Peter Blum
Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
www.PeterBlum.com
0
PLBlum
5/5/2005 2:23:53 AM
Reply:

Similar Artilces:

Custom composite contorl contains custom contols: controls collection gets empty (Or control get reinitialized) on postback.
Hi, I'm  developing a ASP .Net custom server control library. Where all the basic(Text,check,etc) controls are working well. I have developed an composite control which is more like a Tabular control with the basic custom controls in every cell. The problem is, this composite control reinitializes on post back. I 've added the custom controls (in CreateChildControls method) as cell.controls.add(customcontrol)  row.controls.add(cell) ; this.controls.add(row) Please give me a solution as early as possible IMXO. ASP.NET constructs and reinitializes&n...

Creating .Net custom server controls and .Net pages programatically
Thanks a lot for reading this and greatly appreciate your inputs I am writing a webinterface that lets users configure options that'll create an interface for them and generete the webpage. So I am having to programattically create custom server controls and .Net page with code behind to support the functionality. Are there APIs in the .NET SDK that let you do this. Any pointers would be greatly helpful Thanks a lot Sathya Controls on the fly? Or Create code on the fly? I think it is the latter so here we go - look at the following namespaces: * System.Reflection.Emit - gen...

dynamically add control from within another custom control to its containing page
Hello,I would like to add an img control to the begin of the page or form from within a custom control.. Is it possible to add a control to a page from within a custom control like this way: 1 public class myCustomControl :Control2 {3 4 protected override void OnLoad(EventArgs e)5 {6 7 bool foundLoadGif = (this.Page.FindControl("ig_") != null);8 9 if (!foundLoadGif)10 {11 //add img control to the containing page 12 Image imgLoadGif = new Image();13 ...

Problem adding Calender Extender in a custom control . getting erro "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). "
Hi; I am to create a custom control having a Calender extender .. Here is my CreateChildControl Method Protected Overrides Sub CreateChildControls() Dim sb As New StringBuilder Dim DateTextBox As New TextBox DateTextBox.ID = "SomeID" Me.Controls.Add(DateTextBox) Dim Extcalender As New CalendarExtender Extcalender.ID = "Ext" & DateTextBox.ID Extcalender.TargetControlID = DateTextBox.ID Me.Controls.Add(Extcalender) Extcalender = Nothing DateTextBo...

Container reference in custom template control fails when page uses a Master page
Hi, I am trying to create a very simple templated user control.  In fact I've resorted to using an example from MSDN to start with to keep it really simple: http://msdn2.microsoft.com/en-us/library/36574bf6(vs.80).aspxI need to create a similar control that will be happy to be nested in other user controls and within a page templated with a Master page. Inside a normal page and inside nested usercontrols it is perfectly happy. However, when using a master-templated page the Container reference (i.e. <%# Container.Message %>) no longer seems to reference the templated obj...

How to getting custom protocol custom-protocol://some-uri-path to act like http to support page browser?
For example. custom-protocol://some-uri-path/test.html I want the test.html works like http://some-web-site/test.html That I can navigate in the html page. On 6/24/15 1:10 PM, Yonggang Luo wrote: > For example. > custom-protocol://some-uri-path/test.html > > I want the test.html works like > > http://some-web-site/test.html > That I can navigate in the html page. > Check out nsIProtocolHandler Here is an implementation that directly forwards to http(s): http://mxr.mozilla.org/comm-central/source/calendar/base/src/calProtocolHandler.js Ph...

Getting "The page cannot be displayed" on aspx page that contains ajax toolkit controls
Hi, I am working on a .net project that uses the ajax control tool kit on a few aspx pages. When ever i try to access an aspx page that has toolkit controls (modalpopup, popupcontrolextender etc), i get the annoying error message  "page cannot be displayed". This happens only when i access the website after publishing it (from the published folder). However it works fine when i run the project from VS2005 IDE  I am using forms based authentication and have the following directory structure. C:\inetpub\wwwroot\TestWebsite -- contains login page and other static data pag...

Having a problem getting custom controls in a page
I want to extend some existing controls and use them in pages but I keep getting reference problems.  The page can see the controls in design mode but gives me reference error when I try to compile. Please post the code for the page and UC. public class EventCalendar: System.Web.UI.WebControls.Calendar { }      <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %> <%@ Register TagPrefix="...

Inheritance from a page containing a custom control
Hi, How do I inherit a page that contains a custom control, so the derived page will also display the custom contol? I know that the class (code behined page) should inherit the base class, but for some reason in the GUI page of the derived class (aspx), i dont see the custom control that was dragged onto the page of the base class. what am i missing here? Thanks.Be happy. You have to replicate the HTML code from the base page in the derived page, at least the page directives (which contain the control definition) and the actual definition of the control HTML. MasterPages greatly ...

Custom Control: Calling a function on calling page FROM a custom control ? help !!
I have a custom control placed on many pages, to make things simple, basically what I want to do is Call a function on the calling page from the custom control ieAnyone have any ideas, simple solution would be good !!  This is the code I have myControl.ascx.vbPublic Partial Class myControl    Inherits System.Web.UI.UserControl    Protected Sub testButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles testButton.Click        'call save function on PersonalDetails.aspx.vb  &...

slow opening pages.aspx.. what should i do get fast opening pages.aspx ?
hello friends i have almost 20 pages.aspx and 5 masterpages.master :) i have treeview (almost nodes and childnode are 100 totally ) and i have one gridview and 3 text box in pages or like this.. do i use a lot of textbox or treeview ? is it problem ?Sometimes some pages opening so slow (7-9 second) when i click hyperlink or use server.transfer ("*.aspx") or use Response.Redirect(String.Format("Master2.aspx?TextBox1={0}&TextBox2={1}&TextBox3={2}", Label1.Text, Label2.Text, Label3.Text)) to go to another page.aspx but sometimes same pages (slow opening) open so ...

Problem to use TreeView Control in a 'content page' This Error Occur "Only Content controls are allowed directly in a content page that contains Content controls."
hi I am trying to use the TreeView Control inside the content page (Page that has a master page is a content page). On compiling the project I got the following ASP.Net runtime error: "Only Content controls are allowed directly in a content page that contains Content controls."B@b@R J Issue resolved. I was putting script tag in the content page that is not allowed. when remove the script from content page problem is resolved.B@b@R J...

Getting a Page Control property from Custom Code
Greetings all, I have several controls (add/delete/submit buttons, gridview to name a few) in my default.aspx page.  What I want is to be able to get the properties of these controls from a custom class in my BLL folder, and eventually change their properties accordingly. Could someone show me how I can do that? Thanks. Sorry if I have to ask again, but I really need help on how (if possible) I can access and change a web page's web control (button, grid, etc) property from a custom class.  Please if you know how to do this or can point me to a link to resolve my p...

How do I have my Custom Control Get EventLog From Hosting WebForm?
How do I have my Custom Control Get EventLog From Hosting WebForm? Test.aspx:<script runat="server">public void Page_OnInit(){ EventLog log1 =  new EventLog();}</script> <myClass:myCtrl runat="server"/>   MyClass.MyCtrl.dll:public override OnLoad(){ EventLog mylog;  //I hope get log1 form hosting webform(test.aspx) at here. mylog = log1;  mylog.DoSomething() ...} hi! add property to your control that will accept EventLog object, the just write: public void Page_OnInit() {  EventLog log1 =  new EventLog();  m...

Web resources about - how to get the path of page which contain the custom control? - asp.net.hosting-open-forum

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Pilot in Anchorage, Alaska, plane crash took off when control tower was empty - Alaska Dispatch News
Pilot Doug Demarest took off before Merrill Field's control tower opened, allowing him to take off without communicating with controllers before ...

LG’s Amazon Echo-like device controls smart home devices and plays music
... a new device that looks somewhat familiar. The company announced its SmartThinq Hub today, a smart home hub with an LCD display that can control ...

Disable Windows 10 upgrade prompts with GWX Control Panel 1.7
... then the constant "Get Windows 10!" alerts are probably getting annoying. Fortunately you can disable them in seconds with the free GWX Control ...

State Lawmakers Prep Gun Control Policies For 2016
State Lawmakers Prep Gun Control Policies For 2016

Smash glitch lets you control eight characters at once
... around in the game seeing what corners and cracks they can find hidden in its depths. If you've ever for some weird reason wanted to control ...

Global networked lighting controls revenues for commercial buildings expected to total US$38.2 billion ...
The market for lighting controls has expanded greatly alongside the shift from the dominance of fluorescent lighting to LEDs, both in the variety ...

Thinga is a kid-friendly search engine with parental controls
Keeping kids away from questionable content while they surf the web is an ongoing battle, and there's a new site that's looking to help. Thinga, ...

Make 2016 The Year You Take Control Of Your Email
Start your New Year's Rev-olutions off right by getting a handle on that unruly inbox.

'EQUAL TREATMENT' Call to scrap Va. gov's guards over gun control
'EQUAL TREATMENT' Call to scrap Va. gov's guards over gun control

Resources last updated: 1/1/2016 3:12:05 AM