ASP.NET Panel FindControl within DataList to change property C#

Posted by SDC on Stack Overflow See other posts from Stack Overflow or by SDC
Published on 2010-05-25T14:55:50Z Indexed on 2010/05/25 15:11 UTC
Read the original article Hit count: 311

Filed under:
|
|
|

I'm new to this ASP.NET stuff. In my page I have a Datalist with a FooterTemplate. In the footer I have a couple panels that will be visible depending on the QueryString. The problem I am having is trying to find these panels on Page_Load to change the Visible Property. For example this is part of the aspx page:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <asp:DataList ID="dlRecords" runat="server">
  <FooterTemplate>
   <asp:Panel ID="pnlArticleHeader" runat="server" Visible="false" >
   </asp:Panel>
  </FooterTemplate>
 </asp:Datalist>
</asp:Content>

Here is something in the codebehind:

protected void Page_Load(object sender, EventArgs e)
    {
        location = Request.QueryString["location"];
        if (location == "HERE")
        {
          Panel pnlAH = *Need to find control here*;
          pnlAH.Visible=true;
         }
      }

Like I said I am new at this. Everything I have found doesn't seem to work so I decided to post a specific question. Thanks in advance

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET