FindControl

57 views
Skip to first unread message

Paul Beckett

unread,
Apr 30, 2012, 8:10:45 AM4/30/12
to jui...@googlegroups.com
I am using a Juice Tabs control.

How is it possible to access a gridview contained within a tab, from the codebehind? I have tried all sorts of combinations of FindControl but none seem to work.

Thanks

Andrew Powell (appendTo)

unread,
Apr 30, 2012, 9:10:47 AM4/30/12
to Juice UI
I've opened an issue for this and you can following tracking here:
https://github.com/appendto/juiceui/issues/18

Until the next maintenance release, you can access the control as
such:

_Tabs.TabPages[0].Controls[0].Controls[0]

In this case, I am accessing an asp:Textbox, which is the first
control in the first TabPage. It's no where close to pretty or ideal,
but it'll get you by while we fix this.

You could also use Linq. You'll have to add this to your app
somewhere:

/// <summary>
/// Allows Linq operations on the controls collection.
/// </summary>
public static IEnumerable<Control> All(this ControlCollection
controls) {
foreach(Control control in controls) {
foreach(Control grandChild in control.Controls.All())
yield return grandChild;

yield return control;
}
}

And then...

_Tabs.TabPages[0].Controls.Where(c => c.ID == "_Textbox")

Andrew Powell (appendTo)

unread,
Apr 30, 2012, 9:12:39 AM4/30/12
to Juice UI
Sorry, that Linq statement should have read:

_Tabs.TabPages[0].Controls.All().Where(c => c.ID == "_Textbox");

On Apr 30, 9:10 am, "Andrew Powell (appendTo)" <apow...@appendto.com>
wrote:

Paul Beckett

unread,
May 1, 2012, 4:06:36 PM5/1/12
to jui...@googlegroups.com
Thank-you
Reply all
Reply to author
Forward
0 new messages