Questions tagged [controlcollection]

26 questions
23
votes
5 answers

Enumerating Collections that are not inherently IEnumerable?

When you want to recursively enumerate a hierarchical object, selecting some elements based on some criteria, there are numerous examples of techniques like "flattening" and then filtering using Linq : like those found here : link text But, when you…
BillW
  • 3,306
  • 4
  • 24
  • 44
9
votes
2 answers

Render multiple control collections in ASP.NET custom control

I've build a custom WebControl, which has the following structure: Keyword:…
Herman Cordes
  • 4,058
  • 9
  • 46
  • 83
9
votes
3 answers

Will Microsoft ever make all collections useable by LINQ?

I've been using LINQ for awhile (and enjoy it), but it feels like I hit a speedbump when I run across .NET specialized collections(DataRowCollection, ControlCollection). Is there a way to use LINQ with these specialized controls, and if not do you…
Bless Yahu
  • 1,301
  • 1
  • 11
  • 25
4
votes
4 answers

Foreach over multiple ControlCollections

I have a tab control in my Windows Form, and I want to iterate over each element in two different tabs. When a file is opened, I want all the elements of both to be enabled, and when the file is closed, all to be disabled. I have no clue how to…
mowwwalker
  • 14,309
  • 23
  • 87
  • 144
2
votes
2 answers

Using C# to recursively get a collection of controls from a controlcollection

Currently I am trying to extract a collection of dynamically created controls (checkboxes and dropdownlists) from a recursive control collection (repeater). This is the code I am using. private void GetControlList(ControlCollection…
Andy Evans
  • 6,195
  • 17
  • 62
  • 112
2
votes
1 answer

How to reverse a FlowLayoutPanel?

I'm trying to reverse the order of Controls in a FlowLayoutPanel. I tried converting the ControlCollection to an array and then reversed that and cleared the ControlCollection and then readded the Controls. But this doesn't seem to have the planned…
globalenemy
  • 87
  • 1
  • 9
2
votes
4 answers

C# ControlCollection Extension GetAllTextboxes

How could I get only the texboxes in a ControlCollection ? I try : public static IEnumerable TextBoxes(this ControlCollection controlCollection) { return (IEnumerable)controlCollection.Cast().Where(c => c is…
Melursus
  • 9,436
  • 18
  • 66
  • 101
1
vote
0 answers

ASP.NET Get Page control collection at design-time

Whilst trying to capture the HTML from a Web.UI.Page at design-time (in a UITypeEditor) using the RenderControl method, I noticed that only server controls were being rendered. So, given this aspx page:
Jules
  • 4,269
  • 2
  • 39
  • 68
1
vote
1 answer

C# How to remove a control collection from memory

I use a Panel to load controls from different forms into the MainForm. Form1 Form1_loaded = new Form1() { Dock = DockStyle.Fill, TopLevel = false, TopMost = true }; Form1_loaded.FormBorderStyle = FormBorderStyle.None; …
1
vote
1 answer

ControlCollection items could not be saved

I have created a control with controlcollection. When I add items from the property window at design time. It added perfectly. Also when I open it back. Added items shows me. But, When I close the form then open it again the items was removed. Now I…
user3391751
1
vote
3 answers

Adding Controls to Control Collection from an update panel

Following these two threads: How can I create an Array of Controls in C#.NET? Cannot Access the Controls inside an UpdatePanel I current have this: ControlCollection[] currentControlsInUpdatePanel = new…
0
votes
1 answer

Empty ControlCollection at Runtime

I can't find an answer to this anywhere. I define a new instance of a forms control collection, but at runtime, the collection is empty. It works for one load button on the form, but not another. The code is exactly the same, but one works, the…
Scott Godfrey
  • 505
  • 3
  • 6
0
votes
1 answer

How do ControlCollection.Item(s) work?

Sorry for bad English. I need to create and manage a large (not that "large"!) number of controls, through the code. I know how to create them and link the events. The issue is the way of future access to added controls. Which property works better?…
h.nodehi
  • 856
  • 1
  • 12
  • 26
0
votes
1 answer

How to filter empty textboxes with LINQ?

I have 6 textboxes in my panel but not all will be filled in on each user submission. How can I use this LINQ method but filter out the empty textboxes? public void LogHB() { var myTextBoxes = HashboardPanel.Controls …
0
votes
1 answer

Linq To Select All controls where DI contains some text from ControlCollection

Linq has always befuddled me. I am trying to extract all controls from an ASP.Net form page where the ID of the control contains a specific string. The control collection is hierarchical and I want to return any matching controls from all levels. Am…
tjams
  • 3
  • 1
1
2