Questions tagged [dynamic-usercontrols]

Programmatically created instances of any server control

79 questions
6
votes
5 answers

Click event is not firing when I click a control in dynamic usercontrol

I have different controls in my usercontrols. And load usercontrols dynamically in my form UserControl2 usercontrol = new UserControl2(); usercontrol.Tag = i; usercontrol.Click +=…
Karlx Swanovski
  • 2,439
  • 9
  • 31
  • 60
4
votes
1 answer

Exclude Dynamic Rendered User Control From Output Caching

We have a site (actually an Application Builder) that rendered a lot of user controls in different scenarios, One day the manager decided to add Output cache in the main page, OK, every things is fine and the request responded very fast! But in…
Saeid
  • 12,286
  • 26
  • 98
  • 166
4
votes
1 answer

Adding controls to my 'on-the-fly' user-control at design-time..?

I have a C# WinForms 'ListboxPanelControl' UserControl that is composed of a SplitContainer that hosts a user-drawn Listbox control in 'Panel1' on the left. The SplitContainer's right-hand 'Panel2' will host Panels that are added as items are added…
TeeCee
  • 61
  • 5
3
votes
1 answer

UWP MVVM XAML Dynamic UserControl Manager

I need help with a change of perspective. I got stuck trying to approach UWP in a way I used to do in WPF regarding a MVVM pattern for managing UserControls dynamically. I naturally tried to perform the same pattern in UWP but got stuck on various…
Unfolded
  • 39
  • 3
2
votes
2 answers

Correct architecture to extend WinForm UserControl base classes?

I have large number of UserControls that are very similar. They share a lot of common behavior. I been using a base class that has the common stuff and then specializing the class as needed. class BaseControl : UserControl { // common } …
meissnersd
  • 1,186
  • 1
  • 11
  • 19
2
votes
2 answers

How can I move controls into a dynamically added usercontrol into page?

I have a usercontrol that move dynamically on the CreateChildControls method some web controls. When using this control into a page like : It works flawlessly. But if I want to add that…
jpsimard-nyx
  • 7,779
  • 6
  • 29
  • 47
2
votes
2 answers

FindControl won't find my dynamically added UserControl

I'm working on a project where the page load certain controls depending on the index available. The loading occurs in the page load where the method PopulateSearchField is called. Within this method, all the UserControl are added on the page using :…
David
  • 1,071
  • 5
  • 19
  • 38
2
votes
2 answers

Send parameters into dynamically loaded user controls

I load the content of some User Controls into my page with the use of jQuery. So I have this function that extracts the content from my User Control, and it works like a charm. public string GetObjectHtml(string pathToControl) { //…
Martin
  • 5,695
  • 12
  • 55
  • 82
2
votes
3 answers

Storing number of dynamically inserted controls for postback

I need to create the following functionality, and looking for the best way to store info on multiple postbacks: Say I have a TextBox, that is related to a question, i.e. "Places I've visited". Once TextBox will be loaded on first load. Under that,…
mickyjtwin
  • 4,850
  • 13
  • 54
  • 76
2
votes
2 answers

How can I load .ascx user control from console application or windows service?

We use ascx user controls as templates for documents (e.g. invoices). Now I need to load,render to HTML, then transform to PDF these controls from windows service. So, what's the correct way/workaround? TemplateControl.LoadControl(path) doesn't…
creo
  • 49
  • 6
2
votes
0 answers

Dynamic user control loses data while switching between views in multiview

I have a MultiView with two views (first one with form and second one to review data entered in first view). First view contains a TextBox and a PlaceHolder. The PlaceHolder is used to hold dynamically added add UserControl. UserControl contains…
Dangerous Scholar
  • 181
  • 1
  • 2
  • 12
2
votes
2 answers

Are Event Handlers removed from memory if the control linked to the event is removed?

In WPF I have created a control that dynamically creates buttons for me. On some occasions the buttons may change and need be recreated. I am currently using the following: public void GenerateButtons() { WrapPanel_Main.Children.Clear(); …
Anthony Nichols
  • 1,532
  • 1
  • 21
  • 44
2
votes
1 answer

Usercontrol Tab

I made a simple user control for a tab, however when I call it it shows up very small and can resize it to any size at all, here is the code. What do I wrong? public class tabController : UserControl { public tabController(string id) { …
Jaap Terlouw
  • 105
  • 1
  • 12
2
votes
1 answer

Dynamically set a UserControl in a WPF app with MVVM

I'm creating a kind of base WPF application to host WPF user controls, that will come in an assembly (later this will be AddIns). The application and the user control are following MVVM. Unfortunately I'm new to WPF and MVVM, so I am not that…
MikeR
  • 3,005
  • 23
  • 31
2
votes
4 answers

How do I load two ASP.NET UserControls on Demand?

I want load two user controls on demand. asp:UpdatePanel ID="UpdatePanel1" runat="server" ContentTemplate asp:Button ID="Button1" runat="server" Text="Button" UseSubmitBehavior="false" OnClick="Button1_Click" / div…
1
2 3 4 5 6