Hi
I am having an issue when using LoadControl( type, Params ). Let me explain...
I have a super simple user control (ascx)
<%@ Control Language="C#" AutoEventWireup="True" Inherits="ErrorDisplay" Codebehind="ErrorDisplay.ascx.cs" EnableViewState="false" %>
<asp:Label runat="server" ID="lblTitle" />
<asp:Label runat="server" ID="lblD...
I want to make use of "complex" usercontrols with more than one control element within. Its the same control I will reuse in the list and I have a PlaceHolder control for it already.
I can add the control with LoadControl(path to .ascx) - no problem.
I can thru my custom properties get/set access the embedded Labels too, so I can initi...
What I would like to know is if there is a technique to inject parameters into the rendering HttpContext such that it would be available to the UserControl when its page life-cycle events (Page_Init, Page_Load) are called during rendering (during HttpContext.Current.Server.Execute())?
Such a technique would allow injecting data into an...
Hi Everyone !
I've a question about dynamically loaded controls and events in these controls ( button click in my case :)
Here is what i got one RadPanelBar a Button and hidden input:
<telerik:RadPanelBar ID="languagesPanelBar" runat="server">
</telerik:RadPanelBar>
<asp:Button ID="Button1" ru...
Hi,
I want a web service to load an .ascx control, load some values in it and then return the HTML content of this control. I have something like that:
[WebMethod(EnableSession = true)]
public void GetHTML()
{
UserControl loader = new UserControl();
MyCustomReport reportControl =
(MyCustomReport)loader.LoadControl("~/The...
Is it required to call TemplateControl.ResolveUrl() before passing it to TemplateControl.LoadControl()?
Which way is preferred?
LoadControl(ResolveUrl("~/MyControl.ascx"));
LoadControl("~/MyControl.ascx");
LoadControl("MyControl.ascx");
or maybe ResolveClientUrl() ?
...
Question: Is it possible in back end code (not in the code behind but in an actual back end class) to load and render a page or control defined in a .aspx or .ascx without having to use Load(path) and instead just create an instance of the page/control class?
I want to be able to do this (from a back end class NOT a code behind):
MyCon...
Hey all! I'm loading a UserControl through a Web Method, and using the LoadControl functionality as such:
// create page, stringWriter
Page _page = new Page();
StringWriter _writer = new StringWriter();
// get popup control
Controls_Popup_ForumThreadForm _control = _page.LoadControl("~/Controls/Popup_ForumThreadForm.as...
I'm having trouble getting the DetailsView control to perform update event when placed inside UserControl that is in turn loaded by LoadControl.
That same UserControl(with DetailsView) works flawlessly when embedded in a page the standard way(or if i copy/paste the master-detail setup to the page directly).
There are two locations where...
we have a set of usercontrols complied to a dll. we could just load the controls using their classnames by like ASP.theusercontrol_ascx blah = new ASP.theusercontrol_ascx();
but if we have dynamic data and load the controls based on the filename (or the control name),
how can we load them like Page.LoadControl("TheURL/theusercontrol.asc...
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 consi...
I've created 2 controls to manipulate a data object: 1 for viewing and another for editing.
On one page I load the "view" UserControl 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 c...
If e.g. I keep control markup in DB instead of ascx file.
How can I load control from string constant?
(of course if I don't want to save copy to disk)
...
I have written a user control that captures some user input and has a Save button to save it to the DB. I use a repeater to render a number of these controls on the page - imagine a list of multiple choice questions with a Save button by each question.
I am loading the user control inside the repeater's ItemDataBound event like this (co...
Hello.
I have a blank user control (child) and during Page_Load i create some text boxes and a button. I also add an event to the button.
I then load that user control dynamically from a placeholder in another usercontrol (parent).
Both controls are rendered correctly but when i click on the button, the event isnt fired.
Any ideas on h...
I am loading a series of controls in the Page_Load event. However, I have to recreate those controls each page load, which means storing their data elsewhere. This is cumbersome.
protected void Page_Load(object sender, EventArgs e)
{
MyControl control = (MyControl)LoadControl(...);
control.Initialize(GlobalClass.controlData);
...
I'm trying to make a decision about how to display my data. What I have now is a list of products displayed in a repeater. But for code-maintenance I've put my product items in a seperate usercontrol and loading them in a loop with db results using LoadControl.
The product control itself is very simple, just a few public properties like...