Questions tagged [loadcontrol]
42 questions
15
votes
6 answers
Asp.net Usercontrol LoadControl Issue
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"…

Ash
- 5,057
- 7
- 35
- 49
10
votes
3 answers
LoadControl and Page_Load event not firing
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…

StephenPAdams
- 2,797
- 2
- 30
- 49
5
votes
3 answers
How to LoadControl a control that uses VaryByControl OutputCache, specifying values for properties
I've got a user control that should use caching, with VaryByControl. The .ascx file looks like this :
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestControl.ascx.cs" Inherits="mynamespace.TestControl" %>
<%@ OutputCache…

Cosmin Prund
- 25,498
- 2
- 60
- 104
3
votes
1 answer
Panel and User Controls vs load User Controls dynamically
If I want to dynamically show or hide several User Controls. Would it be better to use Panels that load the User Controls and then show or hide the Panels (visible=true/false) or would it be better to use a PlaceHolder and load (add) or…

Aldo
- 33
- 1
- 4
3
votes
2 answers
Dynamically loading user controls in C# Web Application rather than website
I am trying to create my own website management framework similar to DNN/SiteFinity (only a mucho cut down version).
One of the big (but common) features is to be able to dynamically add user controls to provide additional functionality.
I would…

Dan B
- 936
- 2
- 13
- 26
3
votes
4 answers
How do I stop HtmlEditorExtender encoding html in postback?
I have a user control that contains a text box, an HtmlEditorExtender, and a button. The user control is loaded into a parent page using LoadControl(). Whenever I click on the button to post the form, any formatted text in the text box gets encoded,…

Dan C
- 2,236
- 2
- 19
- 30
2
votes
1 answer
ASP .NET UpdatePanel in dynamically loaded control
Currently we have an UpdatePanel containing a Panel as follows:
…

rwbutler
- 387
- 1
- 4
- 19
2
votes
2 answers
LoadControl from windows application
Is it possible to LoadControl in windows application?
I have email generation as web, but I want to move it to windows service for monthly newsletter.
Emails now are implemented as UserControls, in this way html person can easily modify look &…

st78
- 8,028
- 11
- 49
- 68
2
votes
2 answers
Dynamically Loading Controls and Persistence in ASP.NET
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…

Yerg
- 277
- 1
- 3
- 8
2
votes
2 answers
Accessing folder outside website's root folder in asp.net
I have a around 15 websites on a server, i have built a tool which is common across all the sites.
Now instead of keeping the same files inside individual site's folder, i decided to keep the folder common, and keep it outside the website's folder,…

Abbas
- 4,948
- 31
- 95
- 161
2
votes
1 answer
Get User Control HTML
I need to get the HTML of a user control.
At the moment I am using below code.
// Approach 1
HeaderControl hControl = new HeaderControl();
StringBuilder b = new StringBuilder();
HtmlTextWriter h = new HtmlTextWriter(new…

Menol
- 1,230
- 21
- 35
2
votes
1 answer
how to load usercontrols from the assembly using the filename?
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…

Jronny
- 2,164
- 4
- 30
- 41
1
vote
1 answer
parameter injection into dynamically created UserControls without specialization
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…

Jeff Leonard
- 3,284
- 7
- 29
- 27
1
vote
1 answer
Reloading a custom control
I have a cs class which I use as a control on one of my page. It is like a table with some values. This control is loaded when the page loads. After user does some selection, I need to refresh this control with the new values which I do by assigning…

Ratan
- 863
- 5
- 12
- 28
1
vote
1 answer
Dynamically adding the same UserControl multiple times
I have a simple UserControl that I've created that simply allows a user to enter the date. For the time being, it has a single Textbox with ID="tbDate". I am trying to dynamically add this control multiple times via (for example)…

McArthey
- 1,614
- 30
- 62