Monday, March 26, 2012

Tab control & master pages

How do I access a tab control that is on a Default.aspx form, which is diplayed in the ContentPlaceholder from my MasterPage.

Page.FindControl(string controlId) ?

I'm not sure, but I think this works...

Agapito


Nope it does not work.

Maybe im explaining wrong. The control resides in a Default.aspx that will be the ContentPlaceholder. I want to access the control from the master pages. The Tab control resides on the Default.aspx


I also tried

//Page.FindControl(TabContainer1);//Master.FindControl(TabControl1);this.ContentPlaceHolder1.FindControl(TabControl);

Given a Content Placeholder of "GCSContent" and a Tab Container of "TabContainer1", I am able to successfully find the control in the Page_Unload event of MasterPage.master using the following syntax:

this.GCSContent.FindControl("TabContainer1");

how do I accomplish this............?

It tells me that the TabContainer1 does not exist in the current context

protected void MenuItem_Click(object sender, MenuEventArgs e)
{
if (this.Menu1.SelectedItem.Value.Equals("1"))
{


this.ContentPlaceHolder1.FindControl("TabContainer1");
TabContainer1.ActiveTab = TabPanel2;

}

}


What is the ID of the tabContainer?

TabContainer myTabContainer = (TabContainer) this.ContentPlaceHolder1.FindControl("whatever_ID");

No comments:

Post a Comment