How to access master page datalist from a content page ?

Last post 10-02-2006 3:39 PM by bitmask. 1 replies.

Sort Posts:

  • How to access master page datalist from a content page ?

    10-02-2006, 2:40 PM
    • Member
      35 point Member
    • acorrer
    • Member since 08-08-2005, 6:56 PM
    • Posts 11

    Hi everybody.

    I have a datalist on my masterpage :

    <asp:DataList ID="DataList1" runat="server" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" GridLines="Both" >

    <ItemTemplate>

    <a href='<%#DataBinder.Eval(Container.DataItem,"TypeSection")%>.aspx?SectionId=<%#DataBinder.Eval(Container.DataItem,"SectionId")%>'><%#DataBinder.Eval(Container.DataItem, "Titre")%></a>

    <asp:Label ID="flagComplete" runat="server" Visible=false>complet‚e</asp:Label>

    </ItemTemplate>

    <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />

    <SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />

    <ItemStyle BackColor="White" ForeColor="#330099" />

    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />

    </asp:DataList>

    ==================================================== 

    depending of some operations on my content page, I need to remove link(desactivate) from my Datalist(on masterpage) and to set the Label flagComplete(on masterpage) to text "completed" 

    How can i do that ? Thankssssss

    Brain working...
  • Re: How to access master page datalist from a content page ?

    10-02-2006, 3:39 PM
    Answer
    • Contributor
      6,537 point Contributor
    • bitmask
    • Member since 07-29-2003, 11:18 AM
    • Citizen of the Earth
    • Posts 1,228

    You can add a public method to your master page class that takes care of all the control manipulation. You might call the method "SetListItemComplete(string someItemIdentifier)", for instance.

    I have some examples in my article: Master Pages: Tips, Tricks, Traps. Look for the section on content page to master page interaction.

    Scott
    http://www.OdeToCode.com/blogs/scott/
Page 1 of 1 (2 items)