Search Results

Search found 54 results on 3 pages for 'loadcontrol'.

Page 1/3 | 1 2 3  | Next Page >

  • using LoadControl with object initializer to create properties

    - by lloydphillips
    In the past I've used UserControls to create email templates which I can fill properties on and then use LoadControl and then RenderControl to get the html for which to use for the body text of my email. This was within asp.net webforms. I'm in the throws of building an mvc website and wanted to do something similar. I've actually considered putting this functionality in a seperate class library and am looking into how I can do this so that in my web layer I can just call EmailTemplate.SubscriptionEmail() which will then generate the html from my template with properties in relevant places (obviously there needs to be parameters for email address etc in there). I wanted to create a single Render control method for which I can pass a string to the path of the UserControl which is my template. I've come across this on the web that kind of suits my needs: public static string RenderUserControl(string path, string propertyName, object propertyValue) { Page pageHolder = new Page(); UserControl viewControl = (UserControl)pageHolder.LoadControl(path); if (propertyValue != null) { Type viewControlType = viewControl.GetType(); PropertyInfo property = viewControlType.GetProperty(propertyName); if (property != null) property.SetValue(viewControl, propertyValue, null); else { throw new Exception(string.Format( "UserControl: {0} does not have a public {1} property.", path, propertyName)); } } pageHolder.Controls.Add(viewControl); StringWriter output = new StringWriter(); HttpContext.Current.Server.Execute(pageHolder, output, false); return output.ToString(); } My issue is that my UserControl(s) may have multiple and differing properties. So SubscribeEmail may require FirstName and EmailAddress where another email template UserControl (lets call it DummyEmail) would require FirstName, EmailAddress and DateOfBirth. The method above only appears to carry one parameter for propertyName and propertyValue. I considered an array of strings that I could put the varying properties into but then I thought it'd be cool to have an object intialiser so I could call the method like this: RenderUserControl("EmailTemplates/SubscribeEmail.ascs", new object() { Firstname="Lloyd", Email="[email protected]" }) Does that make sense? I was just wondering if this is at all possible in the first place and how I'd implement it? I'm not sure if it would be possible to map the properties set on 'object' to properties on the loaded user control and if it is possible where to start in doing this? Has anyone done something like this before? Can anyone help? Lloyd

    Read the article

  • Getting data from child controls loaded programmatically

    - by Farinha
    I've created 2 controls to manipulate a data object: 1 for viewing and another for editing. On one page I load the "view" User Control and pass data to it this way: ViewControl control = (ViewControl)LoadControl("ViewControl.ascx"); control.dataToView = dataObject; this.container.Controls.Add(control); That's all fine and inside the control I can grab that data and display it. Now I'm trying to follow a similar approach for editing. I have a different User Control for this (with some textboxes for editing) to which I pass the original data the same way I did for the view: EditControl control = (EditControl)LoadControl("EditControl.ascx"); control.dataToEdit = dataObject; this.container.Controls.Add(control); Which also works fine. The problem now is getting to this data. When the user clicks a button I need to fetch the data that was edited and do stuff with it. What's happening is that because the controls are being added programmatically, the data that the user changed doesn't seem to be accessible anywhere. Is there a solution for this? Or is this way of trying to keep things separated and possibly re-usable not possible? Thanks in advance.

    Read the article

  • Dynamic adding of usercontrols not showing control on page

    - by Phil
    I am trying to insert a user control dynamically into my default.aspx page via the following method in the page_init: Dim control As UserControl = LoadControl("~\Modules\Content.ascx") Controls.Add(control) When I run the page there is no sign of the usercontrol. Am I using the correct code to insert the usercontrol? Is there an alternative method of insertion available? Does the fact that the usercontrol has a page_load make a difference? Do I need to register the control in my aspx page at design time? Thanks in advance for any assistance you can offer.

    Read the article

  • Dynamically retrievng UserControl's Virtual Path

    - by Kobojunkie
    I have an application with the FrontEnd separated into one Project file and the Codebehind/classes separated into a completely different class library. What I need is a way to, from the UserControl Type, obtain it's VirtualPath. Typically, we would have this in code Board uc = (Board)Page.LoadControl(@"~\Board.ascx"); But I want is something like this Board uc = (Board)Page.LoadControl(Board.VirtualPath); OR Board uc = Page.LoadControl(Board); Anyone have an idea how I can accomplish this? Thanks in advance

    Read the article

  • An Object reference is required for the non-static field

    - by Muhammad Akhtar
    I have make my existing method to static method to get access in javascript, like.. [WebMethod(EnableSession = true), ScriptMethod()] public static void Build(String ID) { Control releaseControl = LoadControl("~/Controls/MyControl.ascx"); //An Object reference is required for the non-static field, mthod or property // 'System.Web.UI.TemplateControl.LoadControl(string)' plc.Controls.Add(releaseControl); // where plc is place holder control //object reference is required for the nonstatic field, method, or property '_Default.pl' } When I build I am getting error and I have posted these in comments below each line before converted it to static method, it working perfectly. Please suggest me the solution of my issue. Thanks

    Read the article

  • when add dynamic control in update panel then getting failed to load viewsate error ?

    - by Tushar Maru
    when add dynamic control in update panel then getting failed to load viewsate error ? see following example :- UpdatePanel panel = new UpdatePanel(); panel.ContentTemplateContainer.Controls.Clear(); if (strPopupType == "O") { Control ctrl = Page.LoadControl(@"~/Modules/MLM/UnilevelViewer/DesktopModules/OrderDetails.ascx"); OrderDetails orderdetails = (OrderDetails)ctrl; orderdetails.ID = "Orders" + elementID; orderdetails.OrderID = Convert.ToInt32(elementID); //orderdetails.ModuleSkinStyleName = CurrentModuleSkin; panel.ContentTemplateContainer.Controls.Add(ctrl); } else if (strPopupType == "U") { Control ctrl = Page.LoadControl(@"~/Modules/MLM/UnilevelViewer/DesktopModules/UserDetails.ascx"); UserDetails userdetails = (UserDetails)ctrl; userdetails.ID = "Users" + elementID; // userdetails.UserModuleSkinStyleName = CurrentModuleSkin; userdetails.UserID = new Guid(elementID); panel.ContentTemplateContainer.Controls.Add(ctrl); }

    Read the article

  • System.Security.Permissions.SecurityPermission and Reflection on Godaddy

    - by David Murdoch
    I have the following method: public static UserControl LoadControl(string UserControlPath, params object[] constructorParameters) { var p = new Page(); var ctl = p.LoadControl(UserControlPath) as UserControl; // Find the relevant constructor if (ctl != null) { ConstructorInfo constructor = ctl.GetType().BaseType.GetConstructor(constructorParameters.Select(constParam => constParam == null ? "".GetType() : constParam.GetType()).ToArray()); //And then call the relevant constructor if (constructor == null) { throw new MemberAccessException("The requested constructor was not found on : " + ctl.GetType().BaseType.ToString()); } constructor.Invoke(ctl, constructorParameters); } // Finally return the fully initialized UC return ctl; } Which when executed on a Godaddy shared host gives me System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

    Read the article

  • Adding a custom control to a page, then adding multiple custom children into that one, null user con

    - by Rickjaah
    Hello all, While nerding my way through the day again. I came across a problem concerning adding children to an already add child control. I can add the controls, but when trying to use the controls in the added control, they all return null. This is the method: protected override CreateChildControls(EventArgs e) { UserControl uControl = LoadControl("~/controls/TwoColumn.ascx"); PlaceHolder holder = uControl.Controls.FindControl(phrContentMiddle) as PlaceHolder; holder.Controls.Add(LoadControl("~/controls/ImageShowControl"); } When i try to call any type of button/UserControl inside the ImageShowControl.... All return null. Is this something in the Page LifeCycle? If so, what is the way to go to realize this?

    Read the article

  • ASP.NET Wizard control with Dynamic UserControls

    - by wjat777
    Hello everyone I'm trying to use the Wizard control as follows: 1 - In the first step (first screen) has a cheklistbox with several options 2 - For each option selected, will be created an extra step 3 - In some steps may be set up intermediate stages Me problem is that each step is a usercontrol. So if the first step I select option1 and option3, I should create two more steps with usercontrol1 and UserControl3 .... Someone already did something similar? I will try explain better the problem. I'll paste here, but I put a copy of the project in skydrive: http://cid-3d949f1661d00819.skydrive.live.com/self.aspx/C%5E3/WizardControl2.7z It is a very basic example of what I'm trying to do. The project has page.ASPX 1 and 3 usercontrol.ASCX (UC1, UC2 and UC3) Default.ASPX: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" % Option1 Option2 Option3 Code Behind: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebApplication2 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Page_PreInit(object sender, EventArgs e) { LoadSteps(); } private void LoadSteps() { int count = Wizard1.WizardSteps.Count; for (int i = count - 1; i > 0; i--) { WizardStepBase step = Wizard1.WizardSteps[i]; if (step.StepType != WizardStepType.Start) Wizard1.WizardSteps.Remove(step); } string Activities=""; foreach (ListItem item in CheckBoxList1.Items) { if (item.Selected) { WizardStep step = new WizardStep {ID = "step_" + item.Value, Title = "step_" + item.Value}; UserControl uc=null; switch (item.Value) { case "1": uc=(UserControl)LoadControl("~/UC1.ascx"); break; case "2": uc=(UserControl)LoadControl("~/UC2.ascx"); break; case "3": uc=(UserControl)LoadControl("~/UC3.ascx"); break; } step.Controls.Add(uc); Wizard1.WizardSteps.Add(step); } } } protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { LoadSteps(); } } } Control UC1.ASCX to UC3.ASCX has the same code (as an example) usercontrol.ascx: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UC1.ascx.cs" Inherits="WebApplication2.UC1" % AutoPostBack="True" AutoPostBack="True" Code Behind: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebApplication2 { public partial class UC1 : System.Web.UI.UserControl { protected void Page_Init(object sender, EventArgs e) { List list1 = new List { "Alice", "Bob", "Chris" }; List list2 = new List { "UN", "DEUX", "TROIS" }; DropDownList1.DataSource = list1; DropDownList2.DataSource = list2; DropDownList1.DataBind(); DropDownList2.DataBind(); } protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = DropDownList1.SelectedValue; } protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { Label2.Text = DropDownList2.SelectedValue; } } } You can see that the controls UserControls trigger events (they cause postbacks) The behavior of this project is a little different than I described in the first thread, but the problem is the same. After the second time "next" button, you will get an error. Thanks in advance William

    Read the article

  • c# asp.net How to return a usercontrol from a handeler ashx?

    - by Justin808
    I want to return the HTML output of the control from a handler. My code looks like this: <%@ WebHandler Language="C#" Class="PopupCalendar" % using System; using System.IO; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public class PopupCalendar : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; System.Web.UI.Page page = new System.Web.UI.Page(); UserControl ctrl = (UserControl)page.LoadControl("~/Controls/CalendarMonthView.ascx"); page.Form.Controls.Add(ctrl); StringWriter stringWriter = new StringWriter(); HtmlTextWriter tw = new HtmlTextWriter(stringWriter); ctrl.RenderControl(tw); context.Response.Write(stringWriter.ToString()); } public bool IsReusable { get { return false; } } } I'm getting the error: Server Error in '/CMS' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 14: System.Web.UI.Page page = new System.Web.UI.Page(); Line 15: UserControl ctrl = (UserControl)page.LoadControl("~/Controls/CalendarMonthView.ascx"); Line 16: page.Form.Controls.Add(ctrl); Line 17: Line 18: StringWriter stringWriter = new StringWriter(); How can I return the output of a Usercontrol via a handler?

    Read the article

  • Various asp controls in a ASP.NET page

    - by Filipe Costa
    Hello. I am creating a products page, where the user selects an option in a radiobuttonlist for example, and then a control with the various options of that product appears in a placeholder or in a div when on of the radiobuttons is selected. At the moment this is the code: aspx: <form runat="server"> <asp:CheckBoxList ID="Lentes" runat="server" OnClick="EscolheLentes"> <asp:ListItem Value="LU"> Lentes Unifocais </asp:ListItem> <asp:ListItem Value="LP"> Lentes Progressivas </asp:ListItem> </asp:CheckBoxList> <asp:PlaceHolder runat="server" ID="PHLentes"></asp:PlaceHolder> </form> aspx.vb: Protected Sub EscolheLentes() Dim ControlLente As Control If (Me.Lentes.Items.FindByValue("LU").Selected) Then ControlLente = LoadControl("LentesUnifocais.ascx") ElseIf (Me.Lentes.Items.FindByValue("LP").Selected) Then ControlLente = LoadControl("LentesProgressivas.ascx") End If Me.PHLentes.Controls.Add(ControlLente) End Sub Need to use some ajax to load the control right? Am i going in the right direction? Thanks.

    Read the article

  • Issue with dynamically loading a user control on button click

    - by Kumar
    I have a page in which I am loading a user control dynamically as follows: Default.aspx: <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> Default.aspx.cs: protected void Page_Load(object sender, EventArgs e) { var ctrl = LoadControl("~/UserCtrl1.ascx"); ctrl.ID = "ucUserCtrl1"; PlaceHolder1.Controls.Add(ctrl); } Below is the code for UserCtrl1.ascx <asp:Label ID="Label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" /> <br /> <asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder> I am dynamically loading another user control when the Button1 is clicked UserCtrl1.ascx.cs protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "UserControl - 1 button clicked!"; var ctrl = LoadControl("~/UserCtrl2.ascx"); ctrl.ID = "ucUserCtrl2"; PlaceHolder2.Controls.Add(ctrl); } Below is the markup for UserCtrl2.ascx <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label2" runat="server"></asp:Label> <asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button2_Click" /> </ContentTemplate> </asp:UpdatePanel> UserCtrl2.ascx.cs protected void Button2_Click(object sender, EventArgs e) { Label2.Text = "UserControl - 2 button clicked!"; } After the page loads when I click the Button1 in UserCtrl1 the click event fires and I am able to see the Label1 text. It also properly loads the UserCtrl2, but when I click the Button2 in UserCtrl2 the click event dosent fire and even worse when I click the Button2 twice the UserCtrl2 control dissappears from the page. How can I fix this?

    Read the article

  • Loading user controls programatically into a placeholder (asp.net)

    - by Phil
    In my .aspx page I have; <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" AspCompat="True" %> <%@ Register src="Modules/Content.ascx" tagname="Content" tagprefix="uc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:PlaceHolder ID="Modulecontainer" runat="server"></asp:PlaceHolder> </div> </form> </body> </html> In my aspx.vb I have; Try Dim loadmodule As UserControl loadmodule = Me.LoadControl("~/modules/content.ascx") Modulecontainer.Controls.Add(loadmodule) Catch ex As Exception Response.Write(ex.ToString & "<br />") End Try The result is an empty placeholder and no errors. Thanks a lot for any assistance P.S after Fat_Tony's answer I changed the code to; Try Dim loadmodule As ASP.ContentModule loadmodule = CType(LoadControl("~\Modules\Content.ascx"), ASP.ContentModule) Modulecontainer.Controls.Add(loadmodule) Catch ex As Exception Response.Write(ex.ToString & "<br />") End Try But still no results unfortunately.

    Read the article

  • “User Control” uses an incorrect event

    - by Lijo
    Hi, I am using two instances of a user control. But when I click on a button in the user control, both of the instances calls the function corresponding to the first event (AcknowledgeReceipt()) However, when I remove the first user control and clicks on the btnRequestClarification, it calls the correct method (RequestClarification()) Is there a way to correct this behavior? acknowledgeModificationPopupCtrl = (ConfirmationPopup)this.LoadControl("~/ConfirmationPopup.ascx"); plHConfirmationPopup.Controls.Add(acknowledgeModificationPopupCtrl); acknowledgeModificationPopupCtrl.ContinueClick += new EventHandler(AcknowledgeReceipt); RequiredFieldValidator reqFValidatorAcknowledge = (RequiredFieldValidator)acknowledgeModificationPopupCtrl.FindControl("reqValidatorTxt"); reqFValidatorAcknowledge.ValidationGroup = "AcknowledgeReceipt"; acknowledgeModificationPopupCtrl.ValidationGroup = "AcknowledgeReceipt"; btnAcknowledgeReceipt.Attributes.Add("onclick", "validateconfirmPopup('true','xx' ,’yyy','Note' ,'true'); return false;"); requestModificationPopupCtrl = (ConfirmationPopup)this.LoadControl("~/ConfirmationPopup.ascx"); plHConfirmationPopup.Controls.Add(requestModificationPopupCtrl); requestModificationPopupCtrl.ContinueClick += new EventHandler(RequestClarification); RequiredFieldValidator reqFValidator = (RequiredFieldValidator)requestModificationPopupCtrl.FindControl("reqValidatorTxt"); reqFValidator.ValidationGroup = "request"; requestModificationPopupCtrl.ValidationGroup = "request"; btnRequestClarification.Attributes.Add("onclick", "validateconfirmPopup('true',’kkk' ,’lll','ff' ,'true'); return false;"); Thanks Lijo

    Read the article

  • Programatically loading user controls

    - by PhilSando
    Today's little problem is that I am trying to load user controls from my codebehind like so: Dim myControl As UserControl = Page.LoadControl("~\Modules\Content.ascx")              Controls.Add(myControl)  On running the page myControl is no where to be seen. I wonder why that is? Well after a bit of thought the following come to mind... Am I using the correct code to insert the usercontrol? Is there an alternative available? Does the fact that the usercontrol has a page_load method make a difference? Does the fact that the usercontrol is being called from the page_init method make a difference? Do I need to register the control in my aspx page at design time? I'll be looking to answer these questions as the day goes on!

    Read the article

  • .net ViewState in page lifecycle

    - by caltrop
    I have a page containing a control called PhoneInfo.ascx. PhoneInfo is dynamically created using LoadControl() and then the initControl() function is called passing in an initialization object to set some initial textbox values within PhoneInfo. The user then changes these values and hits a submit button on the page which is wired up to the "submit_click" event. This event invokes the GetPhone() function within PhoneInfo. The returned value has all of the new user entered values except that the phoneId value (stored in ViewState and NOT edited by the user) always comes back as null. I believe that the viewstate is responsible for keeping track of user entered data across a postback, so I can't understand how the user values are coming back but not the explicitly set ViewState["PhoneId"] value! If I set the ViewState["PhoneId"] value in PhoneInfo's page_load event, it retrieves it correctly after the postback, but this isn't an option because I can only initialize that value when the page is ready to provide it. I'm sure I am just messing up the page lifecycle somehow, any suggestion or questions would really help! I have included a much simplified version of the actual code below. Containing page's codebehind protected void Page_Load(object sender, EventArgs e) { Phone phone = controlToBind as Phone; PhoneInfo phoneInfo = (PhoneInfo)LoadControl("phoneInfo.ascx"); //Create phoneInfo control phoneInfo.InitControl(phone); //use controlToBind to initialize the new control Controls.Add(phoneInfo); } protected void submit_click(object sender, EventArgs e) { Phone phone = phoneInfo.GetPhone(); } PhoneInfo.ascx codebehind protected void Page_Load(object sender, EventArgs e) { } public void InitControl(Phone phone) { if (phone != null) { ViewState["PhoneId"] = phone.Id; txt_areaCode.Text = SafeConvert.ToString(phone.AreaCode); txt_number.Text = SafeConvert.ToString(phone.Number); ddl_type.SelectedValue = SafeConvert.ToString((int)phone.Type); } } public Phone GetPhone() { Phone phone = new Phone(); if ((int)ViewState["PhoneId"] >= 0) phone.Id = (int)ViewState["PhoneId"]; phone.AreaCode = SafeConvert.ToInt(txt_areaCode.Text); phone.Number = SafeConvert.ToInt(txt_number.Text); phone.Type = (PhoneType)Enum.ToObject(typeof(PhoneType), SafeConvert.ToInt(ddl_type.SelectedValue)); return phone; } }

    Read the article

  • Iframe vs dynamically loading web user controls

    - by kevin
    I need some advice on techniques to perform page redirect in asp.net. Which one is more recommended to use in asp.net? Dynamically changed the src of the Iframe to difference aspx. Dim frame As HtmlControl = CType(Me.FindControl("frameMain"), HtmlControl) frame.Attributes("src") = "page1.aspx" Dynamically load web user controls to an asp:panel. panelMain.Controls.Clear() panelMain.Controls.Add(LoadControl("WebControl/page1.ascx")) (convert all aspx page to web user controls)

    Read the article

  • Getting namespace name not found for ASP.net user control

    - by Joel Barsotti
    So I'm having problems when I try to publish the website. I'm in visual studio 2008 sp1. I've got a bunch of user controls and on a few pages I'm using them programatically. I've got a reference on the aspx page <%@ Reference Control="~/UserControls/Foo.ascx" % Then on the code behing I use ASP.usercontrols_foo newFoo control = (ASP.usercontrols_foo)Page.LoadControl("~/UserControls/Foo.ascx"); If I navigate to the page it works fine, but when I goto publish the website I get a compile time error.

    Read the article

  • Iframe Vs Dynamiclly load web user controls

    - by kevin
    I need some advice on technique to perform page redirect in asp.net. Which one is more recommended to use in asp.net? Dynamically changed the src of the Iframe to difference aspx. Dim frame As HtmlControl = CType(Me.FindControl("frameMain"), HtmlControl) frame.Attributes("src") = "page1.aspx" Dynamically load web user controls to an asp:panel. panelMain.Controls.Clear() panelMain.Controls.Add(LoadControl("WebControl/page1.ascx")) (convert all aspx page to web user controls)

    Read the article

  • Force Page initialization

    - by Tony
    Hi The following code is not causing Page_Load of PhotoList to be called. I want the control to be initialized as if it is in normal Page live cycle, what I should do. Page pageHolder = new Page(); UserControl viewControl = (UserControl)pageHolder.LoadControl("Common/PhotoList.ascx"); pageHolder.Controls.Add(viewControl);

    Read the article

  • Adding a UserControl within another UserControl in Sharepoint 2007

    - by DougJones
    I am using WSPBuilder to create and deploy my web part from a user control, as shown here. This works perfectly well, but I have added another user control to the project. I am adding it in page_init by going the Page.LoadControl("~/_controltemplates/MyControl.ascx"); route. It builds successfully, but after adding it to the page, I get The referenced file '/MyControl.ascx' is not allowed on this page. This control is in the ControlTemplates folder in the hive. In the web.config for this sharepoint 2007 site, all items within _controltemplates are listed as safe, as shown here <SafeControl Src="~/_controltemplates/*" IncludeSubFolders="True" Safe="True" AllowRemoteDesigner="True" /> How do I get the ascx file to be allowed on the page and get this webpart to display successfully?

    Read the article

  • How do I retrieve the values entered in a nested control added dynamically to a webform?

    - by Front Runner
    I have a date range user control with two calendar controls: DateRange.ascx public partial class DateRange { public string FromDate { get { return calFromDate.Text; } set { calFromDate.Text = value; } } public string ToDate { get { return calToDate.Date; } set { calToDate.Text = value; } } } I have another user control in which DateRange control is loaded dynamically: ParamViewer.ascx public partial class ParamViewer { public void Setup(string sControlName) { //Load parameter control Control control = LoadControl("DateRange.ascx"); Controls.Add(control); DateRange dteFrom = (DateRange)control.FindControl("calFromDate"); DateRange dteTo = (DateRange)control.FindControl("calToDate"); } } I have a main page webForm1.aspx where ParamViewer.ascx is added When user enter the dates, they're set correctly in DateRange control. My question is how how do I retrieve the values entered in DateRange (FromDate and ToDate)control from btnSubmit_Click event in webForm1? Please advise. Thank you in advance.

    Read the article

1 2 3  | Next Page >