Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default FindControl

    Hi

    FindControl method is to locate a control with an ID
    property of <<Control>> on the containing page.

    Check ChannelPanelId after adding the Display Panel.

    HTH
    Ravikanth

    >-----Original Message-----
    >I know I am doing or understanding something wrong. This
    >is a code snipet from a server control that accesses the
    >MCMS channel structure to build a dynamic cascading menu
    >system. While this is not the actual code (too
    extensive)
    >it performs the key function and provides the same
    >unsatisfactory results:
    >
    >Channel current = CurrentContext.Channel;
    >Panel Display = new Panel();
    >
    >foreach(Channel subchannel in current.Channels)
    >{
    > Panel channelPanel = new Panel();
    > channelPanel.ID = subchannel.Name;
    > Display.Controls.Add(channelPanel)
    >}
    >
    >string chName = current.Channels[0].Name;
    >Panel foundPanel = Display.FindControl(chName);
    >
    >It seems that since there are 3 subchannels to current,
    >foundPanel should return the first Panel added in the
    >foreach loop. It doesn't. It returns null. Why?
    >
    >Thanks.
    >.
    >
    Ravikanth[MVP] Guest

  2. Similar Questions and Discussions

    1. FindControl in FooterTemplate
      I all I've got a beautifull datalist with a ItemTemplate and a FooterTemplate There is a link button in the itemTemplate and Id'like to change...
    2. Problem with FindControl in VS 2003, VB.Net application
      I have a table in HTML: <table id="tblBudget" Runat="server"> <tr> <TD width="1200px"></TD> <TD width="1600px"></TD> <TD width="500px"></TD>...
    3. Problem with FindControl
      I've been trying to build a tab control, as an alternative to the MS IE TabStrip and MultiPage. It works great. Except for anything that's...
    4. OnEditCommand - .FindControl Returning Null
      cross posted in datagrid group. Inside <columns/> in my datagrid, I have the following template column <asp:templatecolumn HeaderText="To Be...
    5. OnEditCommand - FindControl returning Null
      Inside <columns/> in my datagrid, I have the following template column <asp:templatecolumn HeaderText="To Be Completed By"> <itemtemplate>...
  3. #2

    Default FindControl

    Is there no way of finding the embedded panel prior to
    rendering?
    >-----Original Message-----
    >Hi
    >
    >FindControl method is to locate a control with an ID
    >property of <<Control>> on the containing page.
    >
    >Check ChannelPanelId after adding the Display Panel.
    >
    >HTH
    >Ravikanth
    >
    >
    >>-----Original Message-----
    >>I know I am doing or understanding something wrong.
    This
    >>is a code snipet from a server control that accesses
    the
    >>MCMS channel structure to build a dynamic cascading
    menu
    >>system. While this is not the actual code (too
    >extensive)
    >>it performs the key function and provides the same
    >>unsatisfactory results:
    >>
    >>Channel current = CurrentContext.Channel;
    >>Panel Display = new Panel();
    >>
    >>foreach(Channel subchannel in current.Channels)
    >>{
    >> Panel channelPanel = new Panel();
    >> channelPanel.ID = subchannel.Name;
    >> Display.Controls.Add(channelPanel)
    >>}
    >>
    >>string chName = current.Channels[0].Name;
    >>Panel foundPanel = Display.FindControl(chName);
    >>
    >>It seems that since there are 3 subchannels to current,
    >>foundPanel should return the first Panel added in the
    >>foreach loop. It doesn't. It returns null. Why?
    >>
    >>Thanks.
    >>.
    >>
    >.
    >
    Tim Pacl Guest

  4. #3

    Default RE: FindControl

    Hello Tim,

    I moved the following codes into page_load and the pane could be found now.

    Display = new Panel();
    this.Controls.Add(Display);
    String[] ids = new String[3];
    ids[0] = "panel1";
    ids[1] = "panel2";
    ids[2] = "panel3";

    foreach(Channel subchannel in current.Channels)
    {
    Panel channelPanel = new Panel();
    channelPanel.ID = subchannel.Name;
    Display.Controls.Add(channelPanel)
    }

    Also, I defined Dispaly as a global varialbe as other controls.

    Please test it and let me know whether it is what you needed.

    Best regards,
    Yanhong Huang
    Microsoft Online Partner Support

    Get Secure! - [url]www.microsoft.com/security[/url]
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !Content-Class: urn:content-classes:message
    !From: "Tim Pacl" <timothy_pacl@dell.com>
    !Sender: "Tim Pacl" <timothy_pacl@dell.com>
    !References: <0a2a01c34d28$cc711720$a601280a@phx.gbl> <067c01c34d2b$a4e724d0$a001280a@phx.gbl>
    !Subject: FindControl
    !Date: Fri, 18 Jul 2003 06:05:43 -0700
    !Lines: 49
    !Message-ID: <0a8901c34d2d$4b94dce0$a601280a@phx.gbl>
    !MIME-Version: 1.0
    !Content-Type: text/plain;
    ! charset="iso-8859-1"
    !Content-Transfer-Encoding: 7bit
    !X-Newsreader: Microsoft CDO for Windows 2000
    !X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
    !Thread-Index: AcNNLUuU99knTW0oSzKU98ENrW0k+w==
    !Newsgroups: microsoft.public.dotnet.framework.aspnet
    !Path: cpmsftngxa06.phx.gbl
    !Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:160247
    !NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
    !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    !
    !Is there no way of finding the embedded panel prior to
    !rendering?
    !
    !>-----Original Message-----
    !>Hi
    !>
    !>FindControl method is to locate a control with an ID
    !>property of <<Control>> on the containing page.
    !>
    !>Check ChannelPanelId after adding the Display Panel.
    !>
    !>HTH
    !>Ravikanth
    !>
    !>
    !>>-----Original Message-----
    !>>I know I am doing or understanding something wrong.
    !This
    !>>is a code snipet from a server control that accesses
    !the
    !>>MCMS channel structure to build a dynamic cascading
    !menu
    !>>system. While this is not the actual code (too
    !>extensive)
    !>>it performs the key function and provides the same
    !>>unsatisfactory results:
    !>>
    !>>Channel current = CurrentContext.Channel;
    !>>Panel Display = new Panel();
    !>>
    !>>foreach(Channel subchannel in current.Channels)
    !>>{
    !>> Panel channelPanel = new Panel();
    !>> channelPanel.ID = subchannel.Name;
    !>> Display.Controls.Add(channelPanel)
    !>>}
    !>>
    !>>string chName = current.Channels[0].Name;
    !>>Panel foundPanel = Display.FindControl(chName);
    !>>
    !>>It seems that since there are 3 subchannels to current,
    !>>foundPanel should return the first Panel added in the
    !>>foreach loop. It doesn't. It returns null. Why?
    !>>
    !>>Thanks.
    !>>.
    !>>
    !>.
    !>
    !


    Yan-Hong Huang[MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139