I have a basic web app built with Vs 2012, .net 4.5, using the template for Asp.Net Web Forms Application.
This builds a Master page then I built a page inheriting the Maste page.
in the : FeaturedContent section I have placed my controls.
among these are" a LinkButton LinkButton1, and a Multiview, Multiview1 (with a number of views)
the desired task is to click on Btn1 and have Multiview1 change it's selected index to a desired value.
On the Aspx Page: <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click"><h8>Category of event</h8></asp:LinkButton></li>
On the Cs page:
protected void LinkButton1_Click(object sender, EventArgs e)
{MultiView CurView = (MultiView)FindControl("MultiView1");
CurView.ActiveViewIndex = 0;}
When the code runs the FindControl fails and CurView is null, I have found several references to this being a problem with the Master page in that it does something with the naming, the best solution I have found posted is to use code similar to:
// For each c as Control in Container.Controls
//If TypeOf c Is ControlYouWant Then
//Dim ctl as ControlTypeYouWant = FindControl(c.ClientID)
//End If
//Loop
Of course things are never simple since Container.Controls apparently is not part of the collections available in the current context :(
So at long last: THE QUESTION -- how to change the selected view on a Multiform located in a content section of a page inhierated from a Master page?
Sorry if this is long and rambling.