Questions tagged [dynamic-controls]
310 questions
34
votes
2 answers
Add controls dynamically in flowlayoutpanel
In a windows form, I can add control dynamically by doing this:
for (int i = 0; i < 5; i++)
{
Button button = new Button();
button.Location = new Point(160, 30 * i + 10);
button.Tag = i;
this.Controls.Add(button);
}
How do I add…

Karlx Swanovski
- 2,869
- 9
- 34
- 67
21
votes
6 answers
Removing dynamic controls from panel
I have dynamically generated controls on the panels of windows form and i have also generated a button for removing the controls, all in rows.
int c = 0;
private void button1_Click(object sender, EventArgs e)
{
int v;
v = c++;
…

shariq_khan
- 671
- 4
- 16
- 33
17
votes
1 answer
flowlayout control keeps adding control in the wrong direction in winforms
I have a flowlayout control in winforms, i have set its flow direction to TopDown but it keeps adding controls from left to right, autoscroll is also set to true.
flowLayoutPanel1.Controls.Clear();
Label labelInput = new Label();
ListBox…

PUG
- 4,301
- 13
- 73
- 115
11
votes
4 answers
Dynamically Change User Control in ASP.Net
I'm trying to create a web page that will display an appropriate user control based on the selected value of a drop down list.
Basically the page layout is this:
Drop Down Selection
< User Control created based on drop down selection >
I have it…

grimus
- 3,175
- 2
- 18
- 26
7
votes
3 answers
Dynamic created controls inside UpdatePanel?
I want to create control that will allow user to design his own website structure. I imagined that inside UpdatePanel is control(s) with TextBox ( for page name) and Button 'add below'. It would looks like:
| "Questions" |
| [ add below ] |
| …

zgorawski
- 2,597
- 4
- 30
- 43
7
votes
3 answers
Dynamically added controls remove when dropdown event fired in the datalist in user control
I am working on an ASP.NET VB.NET web form - a reservation web application, in which only one aspx page and rest are user-control page.
At run-time of aspx page, user controls load as per step and name define in db, like in below link.
ASP.NET…

Ajay2707
- 5,690
- 6
- 40
- 58
6
votes
3 answers
.NET 4.5 WebForms: do I (still) really have to specify all 3 templates in a FormView?
Investigating the new strongly-typed, model-binding approach within ASP.NET 4.5 WebForms:
In Scott Hanselman's example of WebForms model binding (amongst others) I've seen the use of a FormView that opens in "Edit" mode, containing a number of…

Merenzo
- 5,326
- 4
- 31
- 46
5
votes
2 answers
Insert dynamic controls into middle of controls collection
this is my very first post! I'm pretty desperate so I'm going above and beyond my standard googling. I believe this is an advanced or expert-level .NET question.
The problem is that I have built a .NET web application that needs to be able to insert…

jakejgordon
- 4,008
- 7
- 36
- 45
5
votes
3 answers
Dynamically Create controls and save the controls values across postback - ASP.Net C#
Consider this -
I allow the end user to create a tab control dynamically in an ASP.Net page by getting some details. For each and every tab added I get some settings -
Tab Title
Tab Content
Tab Footer link
So I get these details for each and every…

NLV
- 21,141
- 40
- 118
- 183
5
votes
5 answers
dynamic controls based on user postback
Suppose I have a treeview, where each treenode contains an id for a different set of user controls. When the user clicks a node, these controls should be loaded to the page. As I understand the ASP page life cycle, dynamic controls should be added…

tbischel
- 6,337
- 11
- 51
- 73
5
votes
4 answers
LoadControl in static/shared function
Anyone know how I can dynamically load a control inside of a shared/static function? The function itself is inside of a mustinherit/abstract class. (It's an ASP.NET project in VB) I want to do something like this:
VB:
Public Shared Function…

jorelli
- 8,064
- 4
- 36
- 35
5
votes
3 answers
Controls do not appear on dynamically created user control
I have user control named DateTimeUC which has two textboxes on its markup:
I am dynamically creating this control in another…

Serhat Ozgel
- 23,496
- 29
- 102
- 138
5
votes
1 answer
How to clone / copy a control (with child controls) using asp.net?
I've tried a few different solutions found on here and elsewhere on the web without luck so far. Maybe one of you knowledgeable lot might be able to help...
I have a bunch of dynamically created controls by the user which I'm storing as a control…

wotney
- 1,039
- 3
- 21
- 34
4
votes
6 answers
Dynamic ASP.net Web Forms
I am creating an ASP.NET application in which the administrator of the program will be able to define custom fields for forms that the users will fill out and submit.
The admin needs to define various types of fields like checkboxes, radio buttons,…

Ronnie Overby
- 45,287
- 73
- 267
- 346
4
votes
1 answer
ASP.Net: drop down list and data source created dynamically
I have about 10 drop down list controls that get populated. Instead of copying/pasting and modifying a few fields on each, I would like to create them programmatically. Can this be done?
Here is what one of them looks like. I would like to…

dotnet-practitioner
- 13,968
- 36
- 127
- 200