2009-04-23 5 views

答えて

1

は、あなたが試してみました:関心のうち

Me.Controls.Cast(Of Control) 

を、なぜあなたはIQueryableとして、それが必要なのでしょうか? IEnumerable<T>で十分ですか? (これはCastの結果です)

AsQueryableを呼び出すだけで問題が発生するのは、コントロールコレクションにIEnumerable<T>IEnumerable)が実装されていないことです。

1

また、コントロールを入れ子にすることができることを忘れないでください、そしてちょうどそれのコントロールのためのページを尋ねることは唯一の直接子供たちを教えてくれますが、それはこれらのコントロールのコントロールをご紹介しません:

Locate the web forms controls on a page by walking the Controls Collection

This example finds only the controls contained in the Page object and the controls that are direct children of the page. It does not find text boxes that are children of a control that is in turn a child of the page. For example, if you added a Panel control to page, the Panel control would be a child of the HtmlForm control contained by the Page, and it would be found in this example. However, if you then added a TextBox control into the Panel control, the TextBox control text would not be displayed by the example, because it is not a child of the page or of a control that is a child of the page. A more practical application of walking the controls this way would be to create a recursive method that can be called to walk the Controls collection of each control as it is encountered. However, for clarity, the example below is not created as a recursive function.

関連する問題