RE: Dynamically Add and Remove Accordion Control Panes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Allen Chen [MSFT]

    RE: Dynamically Add and Remove Accordion Control Panes

    Hi Richard,

    Quote from Richard======== =============== =============== ============

    However I also want to be able to remove the
    panes. I have tried to include this, but find that when I first add the
    pane
    the remove event does not get handled, though thereafter it is handled
    without problems.
    =============== =============== =============== =====

    Sorry Richard but I'm not quite clear about what you mentioned above. Do
    you mean when you add the pane the remove event will not fire? If so I
    think it's normal. Why the remove event need to fire when we add the pane?
    From the code you provided I think the Remove_Pane will be called if user
    clicks the removeLB LinkButton.

    I could not find the definition of LocationInfoDTO and the other controls
    defined in the aspx so I cannot reproduce it on my side. Could you send me
    a demo project and clarify the problem? My email is v-alchen@microsof t.com.

    Regards,
    Allen Chen
    Microsoft Online Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    msdnmg@microsof t.com.

    =============== =============== =============== =====
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subs...#notifications.

    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 2 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working with a dedicated Microsoft Support Engineer
    by contacting Microsoft Customer Support Services (CSS) at

    =============== =============== =============== =====
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    | From: "RichB" <richsanswers@c ommunity.nospam >
    | Subject: Dynamically Add and Remove Accordion Control Panes
    | Date: Fri, 31 Oct 2008 15:54:01 -0000
    | Lines: 178
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
    | X-RFC2646: Format=Flowed; Original
    | Message-ID: <O1YUnD3OJHA.43 12@TK2MSFTNGP06 .phx.gbl>
    | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
    | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
    | Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
    | Xref: TK2MSFTNGHUB02. phx.gbl
    microsoft.publi c.dotnet.framew ork.aspnet:7899 4
    | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
    |
    |
    | I have a Page which contains an Accordion Control with dynamically added
    | custom panes. I have added a link button to the page to allow further
    panes
    | to be added and this works. However I also want to be able to remove the
    | panes. I have tried to include this, but find that when I first add the
    pane
    | the remove event does not get handled, though thereafter it is handled
    | without problems. I would be grateful if someone could take a look and
    | advise why I am getting this problem (I have attached all relevant code).
    |
    | Thanks, Richard
    |
    |
    |
    |

  • RichB

    #2
    Re: Dynamically Add and Remove Accordion Control Panes

    Allen,

    I have now managed to resolve this. I noticed in another post a similar
    problem which uses the
    HttpContext.Cur rent.Request.Fo rm["__EVENTTAR GET"] string to get the button
    clicked and process it within the Page_PreInit rather than in the event.
    This works fine, unless you believe that this approach is inappropriate,
    then please ignore my email with example code.

    This seems to be an easy approach, far easier than using the click event.
    How should I decide whether to use the click event versus this method?

    Thanks,
    Richard




    "Allen Chen [MSFT]" <v-alchen@online.m icrosoft.comwro te in message
    news:OnReJiVPJH A.1644@TK2MSFTN GHUB02.phx.gbl. ..
    Hi Richard,
    >
    Quote from Richard======== =============== =============== ============
    >
    However I also want to be able to remove the
    panes. I have tried to include this, but find that when I first add the
    pane
    the remove event does not get handled, though thereafter it is handled
    without problems.
    =============== =============== =============== =====
    >
    Sorry Richard but I'm not quite clear about what you mentioned above. Do
    you mean when you add the pane the remove event will not fire? If so I
    think it's normal. Why the remove event need to fire when we add the pane?
    From the code you provided I think the Remove_Pane will be called if user
    clicks the removeLB LinkButton.
    >
    I could not find the definition of LocationInfoDTO and the other controls
    defined in the aspx so I cannot reproduce it on my side. Could you send me
    a demo project and clarify the problem? My email is
    v-alchen@microsof t.com.
    >
    Regards,
    Allen Chen
    Microsoft Online Support
    >
    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    msdnmg@microsof t.com.
    >
    =============== =============== =============== =====
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subs...#notifications.
    >
    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 2 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working with a dedicated Microsoft Support
    Engineer
    by contacting Microsoft Customer Support Services (CSS) at

    =============== =============== =============== =====
    This posting is provided "AS IS" with no warranties, and confers no
    rights.
    >
    --------------------
    | From: "RichB" <richsanswers@c ommunity.nospam >
    | Subject: Dynamically Add and Remove Accordion Control Panes
    | Date: Fri, 31 Oct 2008 15:54:01 -0000
    | Lines: 178
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
    | X-RFC2646: Format=Flowed; Original
    | Message-ID: <O1YUnD3OJHA.43 12@TK2MSFTNGP06 .phx.gbl>
    | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
    | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
    | Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
    | Xref: TK2MSFTNGHUB02. phx.gbl
    microsoft.publi c.dotnet.framew ork.aspnet:7899 4
    | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
    |
    |
    | I have a Page which contains an Accordion Control with dynamically added
    | custom panes. I have added a link button to the page to allow further
    panes
    | to be added and this works. However I also want to be able to remove the
    | panes. I have tried to include this, but find that when I first add the
    pane
    | the remove event does not get handled, though thereafter it is handled
    | without problems. I would be grateful if someone could take a look and
    | advise why I am getting this problem (I have attached all relevant
    code).
    |
    | Thanks, Richard
    |
    |
    |
    |
    >

    Comment

    • Allen Chen [MSFT]

      #3
      Re: Dynamically Add and Remove Accordion Control Panes

      Hello Richard,

      I think either way is ok. Actually ASP.NET internally checks the event
      target via the Request.Form as well. I just want to mention when can use
      __EVENTTARGET to get the clicked button id. To test, please create a new
      web application and try following code:

      Test1:

      Aspx:
      <asp:Label ID="Label1" runat="server"> </asp:Label>
      <asp:Button ID="Button1" runat="server" Text="Button"
      onclick="Button 1_Click1" />

      Aspx.cs:

      protected void Page_PreInit(ob ject sender, EventArgs e)
      {
      if (IsPostBack)
      {
      if (Request.Form["__EVENTTAR GET"] != null &&
      Request.Form["__EVENTTAR GET"]!=String.Empty)
      {
      this.Label1.Tex t = Request.Form["__EVENTTAR GET"];
      }
      else {
      this.Label1.Tex t = "No value";
      }
      }
      }

      protected void Button1_Click1( object sender, EventArgs e)
      {

      }

      You can see the Label will show "No value" when you click the button.

      Test2:

      If we try this:

      <asp:Button ID="Button1" runat="server" Text="Button"
      UseSubmitBehavi or="false"
      onclick="Button 1_Click1" />

      The Label will show the button id.

      The difference is due to adding the UseSubmitBehavi or="false", which
      changes the HTML rendered by the ASP.NET button control. We can view source
      to see what's the rendered HTML.

      The HTML rendered by Test1:

      <span id="Label1"></span>
      <input type="submit" name="Button1" value="Button" id="Button1" />


      The HTML rendered by Test2:

      <input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET" value="" />

      <script type="text/javascript">
      //<![CDATA[
      var theForm = document.forms['form1'];
      if (!theForm) {
      theForm = document.form1;
      }
      function __doPostBack(ev entTarget, eventArgument) {
      if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
      theForm.__EVENT TARGET.value = eventTarget;
      theForm.__EVENT ARGUMENT.value = eventArgument;
      theForm.submit( );
      }
      }
      //]]>
      </script>


      <span id="Label1">But ton1</span>
      <input type="button" name="Button1" value="Button"
      onclick="javasc ript:__doPostBa ck('Button1','' )" id="Button1" />

      We can see in Test2 the ASP.NET button control will call javascript
      function when we click the button. In that function it assigns the id to
      the __EVENTTARGET hidden field thus we can get the id at server side via
      Request.Form. (As we know the hidden input will be submitted to the server
      along with the form).

      Then the question is how the ASP.NET can know which button is clicked if
      the id cannot be retrieved from the __EVENTTARGET, namely in the Test1 how
      the button click event can fire? We need to notice another difference in
      the html, that is the type of the <inputrendere d by the ASP.NET button
      control. In the Test1 it's of type submit while in Test2 it's of type
      button. The browser will treat the submit input differently. The id of the
      submit input will be sent to the request along with the form just as the
      hidden input. On the ProcessPostData stage of the page life cycle the
      ASP.NET page will check all the posted data and use FindControl method to
      find the control. When a reference is got it will check if the control
      implements IPostBackEventH andler. If it does the page will call
      this.RegisterRe quiresRaiseEven t(control.PostB ackEventHandler ) to register
      the event handler for later call. Since the button implements this
      interface it can benefit from this feature as long as its id is posted to
      server on postback.

      If you need further questions please feel free to ask.

      Regards,
      Allen Chen
      Microsoft Online Support

      Delighting our customers is our #1 priority. We welcome your comments and
      suggestions about how we can improve the support we provide to you. Please
      feel free to let my manager know what you think of the level of service
      provided. You can send feedback directly to my manager at:
      msdnmg@microsof t.com.

      =============== =============== =============== =====
      Get notification to my posts through email? Please refer to
      http://msdn.microsoft.com/en-us/subs...#notifications.

      Note: MSDN Managed Newsgroup support offering is for non-urgent issues
      where an initial response from the community or a Microsoft Support
      Engineer within 2 business day is acceptable. Please note that each follow
      up response may take approximately 2 business days as the support
      professional working with you may need further investigation to reach the
      most efficient resolution. The offering is not appropriate for situations
      that require urgent, real-time or phone-based interactions. Issues of this
      nature are best handled working with a dedicated Microsoft Support Engineer
      by contacting Microsoft Customer Support Services (CSS) at

      =============== =============== =============== =====
      This posting is provided "AS IS" with no warranties, and confers no rights.

      --------------------
      | From: "RichB" <richsanswers@c ommunity.nospam >
      | References: <O1YUnD3OJHA.43 12@TK2MSFTNGP06 .phx.gbl>
      <OnReJiVPJHA.16 44@TK2MSFTNGHUB 02.phx.gbl>
      | Subject: Re: Dynamically Add and Remove Accordion Control Panes
      | Date: Tue, 4 Nov 2008 11:39:11 -0000
      | Lines: 109
      | X-Priority: 3
      | X-MSMail-Priority: Normal
      | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
      | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
      | X-RFC2646: Format=Flowed; Original
      | Message-ID: <ef3G0HnPJHA.40 08@TK2MSFTNGP02 .phx.gbl>
      | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
      | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
      | Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP02.phx .gbl
      | Xref: TK2MSFTNGHUB02. phx.gbl
      microsoft.publi c.dotnet.framew ork.aspnet:7917 0
      | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
      |
      | Allen,
      |
      | I have now managed to resolve this. I noticed in another post a similar
      | problem which uses the
      | HttpContext.Cur rent.Request.Fo rm["__EVENTTAR GET"] string to get the
      button
      | clicked and process it within the Page_PreInit rather than in the event.
      | This works fine, unless you believe that this approach is inappropriate,
      | then please ignore my email with example code.
      |
      | This seems to be an easy approach, far easier than using the click event.
      | How should I decide whether to use the click event versus this method?
      |
      | Thanks,
      | Richard
      |
      |
      |
      |
      | "Allen Chen [MSFT]" <v-alchen@online.m icrosoft.comwro te in message
      | news:OnReJiVPJH A.1644@TK2MSFTN GHUB02.phx.gbl. ..
      | Hi Richard,
      | >
      | Quote from Richard======== =============== =============== ============
      | >
      | However I also want to be able to remove the
      | panes. I have tried to include this, but find that when I first add the
      | pane
      | the remove event does not get handled, though thereafter it is handled
      | without problems.
      | =============== =============== =============== =====
      | >
      | Sorry Richard but I'm not quite clear about what you mentioned above. Do
      | you mean when you add the pane the remove event will not fire? If so I
      | think it's normal. Why the remove event need to fire when we add the
      pane?
      | From the code you provided I think the Remove_Pane will be called if
      user
      | clicks the removeLB LinkButton.
      | >
      | I could not find the definition of LocationInfoDTO and the other
      controls
      | defined in the aspx so I cannot reproduce it on my side. Could you send
      me
      | a demo project and clarify the problem? My email is
      | v-alchen@microsof t.com.
      | >
      | Regards,
      | Allen Chen
      | Microsoft Online Support
      | >
      | Delighting our customers is our #1 priority. We welcome your comments
      and
      | suggestions about how we can improve the support we provide to you.
      Please
      | feel free to let my manager know what you think of the level of service
      | provided. You can send feedback directly to my manager at:
      | msdnmg@microsof t.com.
      | >
      | =============== =============== =============== =====
      | Get notification to my posts through email? Please refer to
      | >
      http://msdn.microsoft.com/en-us/subs...#notifications.
      | >
      | Note: MSDN Managed Newsgroup support offering is for non-urgent issues
      | where an initial response from the community or a Microsoft Support
      | Engineer within 2 business day is acceptable. Please note that each
      follow
      | up response may take approximately 2 business days as the support
      | professional working with you may need further investigation to reach
      the
      | most efficient resolution. The offering is not appropriate for
      situations
      | that require urgent, real-time or phone-based interactions. Issues of
      this
      | nature are best handled working with a dedicated Microsoft Support
      | Engineer
      | by contacting Microsoft Customer Support Services (CSS) at
      | http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
      | =============== =============== =============== =====
      | This posting is provided "AS IS" with no warranties, and confers no
      | rights.
      | >
      | --------------------
      | | From: "RichB" <richsanswers@c ommunity.nospam >
      | | Subject: Dynamically Add and Remove Accordion Control Panes
      | | Date: Fri, 31 Oct 2008 15:54:01 -0000
      | | Lines: 178
      | | X-Priority: 3
      | | X-MSMail-Priority: Normal
      | | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
      | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
      | | X-RFC2646: Format=Flowed; Original
      | | Message-ID: <O1YUnD3OJHA.43 12@TK2MSFTNGP06 .phx.gbl>
      | | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
      | | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
      | | Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
      | | Xref: TK2MSFTNGHUB02. phx.gbl
      | microsoft.publi c.dotnet.framew ork.aspnet:7899 4
      | | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
      | |
      | |
      | | I have a Page which contains an Accordion Control with dynamically
      added
      | | custom panes. I have added a link button to the page to allow further
      | panes
      | | to be added and this works. However I also want to be able to remove
      the
      | | panes. I have tried to include this, but find that when I first add
      the
      | pane
      | | the remove event does not get handled, though thereafter it is handled
      | | without problems. I would be grateful if someone could take a look and
      | | advise why I am getting this problem (I have attached all relevant
      | code).
      | |
      | | Thanks, Richard
      | |
      | |
      | |
      | |
      | >
      |
      |
      |

      Comment

      • RichB

        #4
        Re: Dynamically Add and Remove Accordion Control Panes

        Thanks, it all makes a lot more sense looking at some of behind the scenes,
        but I'll bare in mind the issues below.

        Thanks, for your help.
        Richard

        "Allen Chen [MSFT]" <v-alchen@online.m icrosoft.comwro te in message
        news:ZM7f2quPJH A.3440@TK2MSFTN GHUB02.phx.gbl. ..
        Hello Richard,
        >
        I think either way is ok. Actually ASP.NET internally checks the event
        target via the Request.Form as well. I just want to mention when can use
        __EVENTTARGET to get the clicked button id. To test, please create a new
        web application and try following code:
        >
        Test1:
        >
        Aspx:
        <asp:Label ID="Label1" runat="server"> </asp:Label>
        <asp:Button ID="Button1" runat="server" Text="Button"
        onclick="Button 1_Click1" />
        >
        Aspx.cs:
        >
        protected void Page_PreInit(ob ject sender, EventArgs e)
        {
        if (IsPostBack)
        {
        if (Request.Form["__EVENTTAR GET"] != null &&
        Request.Form["__EVENTTAR GET"]!=String.Empty)
        {
        this.Label1.Tex t = Request.Form["__EVENTTAR GET"];
        }
        else {
        this.Label1.Tex t = "No value";
        }
        }
        }
        >
        protected void Button1_Click1( object sender, EventArgs e)
        {
        >
        }
        >
        You can see the Label will show "No value" when you click the button.
        >
        Test2:
        >
        If we try this:
        >
        <asp:Button ID="Button1" runat="server" Text="Button"
        UseSubmitBehavi or="false"
        onclick="Button 1_Click1" />
        >
        The Label will show the button id.
        >
        The difference is due to adding the UseSubmitBehavi or="false", which
        changes the HTML rendered by the ASP.NET button control. We can view
        source
        to see what's the rendered HTML.
        >
        The HTML rendered by Test1:
        >
        <span id="Label1"></span>
        <input type="submit" name="Button1" value="Button" id="Button1" />
        >
        >
        The HTML rendered by Test2:
        >
        <input type="hidden" name="__EVENTTA RGET" id="__EVENTTARG ET" value="" />
        >
        <script type="text/javascript">
        //<![CDATA[
        var theForm = document.forms['form1'];
        if (!theForm) {
        theForm = document.form1;
        }
        function __doPostBack(ev entTarget, eventArgument) {
        if (!theForm.onsub mit || (theForm.onsubm it() != false)) {
        theForm.__EVENT TARGET.value = eventTarget;
        theForm.__EVENT ARGUMENT.value = eventArgument;
        theForm.submit( );
        }
        }
        //]]>
        </script>
        >
        >
        <span id="Label1">But ton1</span>
        <input type="button" name="Button1" value="Button"
        onclick="javasc ript:__doPostBa ck('Button1','' )" id="Button1" />
        >
        We can see in Test2 the ASP.NET button control will call javascript
        function when we click the button. In that function it assigns the id to
        the __EVENTTARGET hidden field thus we can get the id at server side via
        Request.Form. (As we know the hidden input will be submitted to the server
        along with the form).
        >
        Then the question is how the ASP.NET can know which button is clicked if
        the id cannot be retrieved from the __EVENTTARGET, namely in the Test1 how
        the button click event can fire? We need to notice another difference in
        the html, that is the type of the <inputrendere d by the ASP.NET button
        control. In the Test1 it's of type submit while in Test2 it's of type
        button. The browser will treat the submit input differently. The id of the
        submit input will be sent to the request along with the form just as the
        hidden input. On the ProcessPostData stage of the page life cycle the
        ASP.NET page will check all the posted data and use FindControl method to
        find the control. When a reference is got it will check if the control
        implements IPostBackEventH andler. If it does the page will call
        this.RegisterRe quiresRaiseEven t(control.PostB ackEventHandler ) to register
        the event handler for later call. Since the button implements this
        interface it can benefit from this feature as long as its id is posted to
        server on postback.
        >
        If you need further questions please feel free to ask.
        >
        Regards,
        Allen Chen
        Microsoft Online Support
        >
        Delighting our customers is our #1 priority. We welcome your comments and
        suggestions about how we can improve the support we provide to you. Please
        feel free to let my manager know what you think of the level of service
        provided. You can send feedback directly to my manager at:
        msdnmg@microsof t.com.
        >
        =============== =============== =============== =====
        Get notification to my posts through email? Please refer to
        http://msdn.microsoft.com/en-us/subs...#notifications.
        >
        Note: MSDN Managed Newsgroup support offering is for non-urgent issues
        where an initial response from the community or a Microsoft Support
        Engineer within 2 business day is acceptable. Please note that each follow
        up response may take approximately 2 business days as the support
        professional working with you may need further investigation to reach the
        most efficient resolution. The offering is not appropriate for situations
        that require urgent, real-time or phone-based interactions. Issues of this
        nature are best handled working with a dedicated Microsoft Support
        Engineer
        by contacting Microsoft Customer Support Services (CSS) at

        =============== =============== =============== =====
        This posting is provided "AS IS" with no warranties, and confers no
        rights.
        >
        --------------------
        | From: "RichB" <richsanswers@c ommunity.nospam >
        | References: <O1YUnD3OJHA.43 12@TK2MSFTNGP06 .phx.gbl>
        <OnReJiVPJHA.16 44@TK2MSFTNGHUB 02.phx.gbl>
        | Subject: Re: Dynamically Add and Remove Accordion Control Panes
        | Date: Tue, 4 Nov 2008 11:39:11 -0000
        | Lines: 109
        | X-Priority: 3
        | X-MSMail-Priority: Normal
        | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
        | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
        | X-RFC2646: Format=Flowed; Original
        | Message-ID: <ef3G0HnPJHA.40 08@TK2MSFTNGP02 .phx.gbl>
        | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
        | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
        | Path: TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP02.phx .gbl
        | Xref: TK2MSFTNGHUB02. phx.gbl
        microsoft.publi c.dotnet.framew ork.aspnet:7917 0
        | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
        |
        | Allen,
        |
        | I have now managed to resolve this. I noticed in another post a similar
        | problem which uses the
        | HttpContext.Cur rent.Request.Fo rm["__EVENTTAR GET"] string to get the
        button
        | clicked and process it within the Page_PreInit rather than in the event.
        | This works fine, unless you believe that this approach is inappropriate,
        | then please ignore my email with example code.
        |
        | This seems to be an easy approach, far easier than using the click
        event.
        | How should I decide whether to use the click event versus this method?
        |
        | Thanks,
        | Richard
        |
        |
        |
        |
        | "Allen Chen [MSFT]" <v-alchen@online.m icrosoft.comwro te in message
        | news:OnReJiVPJH A.1644@TK2MSFTN GHUB02.phx.gbl. ..
        | Hi Richard,
        | >
        | Quote from Richard======== =============== =============== ============
        | >
        | However I also want to be able to remove the
        | panes. I have tried to include this, but find that when I first add
        the
        | pane
        | the remove event does not get handled, though thereafter it is handled
        | without problems.
        | =============== =============== =============== =====
        | >
        | Sorry Richard but I'm not quite clear about what you mentioned above.
        Do
        | you mean when you add the pane the remove event will not fire? If so I
        | think it's normal. Why the remove event need to fire when we add the
        pane?
        | From the code you provided I think the Remove_Pane will be called if
        user
        | clicks the removeLB LinkButton.
        | >
        | I could not find the definition of LocationInfoDTO and the other
        controls
        | defined in the aspx so I cannot reproduce it on my side. Could you
        send
        me
        | a demo project and clarify the problem? My email is
        | v-alchen@microsof t.com.
        | >
        | Regards,
        | Allen Chen
        | Microsoft Online Support
        | >
        | Delighting our customers is our #1 priority. We welcome your comments
        and
        | suggestions about how we can improve the support we provide to you.
        Please
        | feel free to let my manager know what you think of the level of
        service
        | provided. You can send feedback directly to my manager at:
        | msdnmg@microsof t.com.
        | >
        | =============== =============== =============== =====
        | Get notification to my posts through email? Please refer to
        | >
        http://msdn.microsoft.com/en-us/subs...#notifications.
        | >
        | Note: MSDN Managed Newsgroup support offering is for non-urgent issues
        | where an initial response from the community or a Microsoft Support
        | Engineer within 2 business day is acceptable. Please note that each
        follow
        | up response may take approximately 2 business days as the support
        | professional working with you may need further investigation to reach
        the
        | most efficient resolution. The offering is not appropriate for
        situations
        | that require urgent, real-time or phone-based interactions. Issues of
        this
        | nature are best handled working with a dedicated Microsoft Support
        | Engineer
        | by contacting Microsoft Customer Support Services (CSS) at
        | http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
        | =============== =============== =============== =====
        | This posting is provided "AS IS" with no warranties, and confers no
        | rights.
        | >
        | --------------------
        | | From: "RichB" <richsanswers@c ommunity.nospam >
        | | Subject: Dynamically Add and Remove Accordion Control Panes
        | | Date: Fri, 31 Oct 2008 15:54:01 -0000
        | | Lines: 178
        | | X-Priority: 3
        | | X-MSMail-Priority: Normal
        | | X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
        | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
        | | X-RFC2646: Format=Flowed; Original
        | | Message-ID: <O1YUnD3OJHA.43 12@TK2MSFTNGP06 .phx.gbl>
        | | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
        | | NNTP-Posting-Host: 93-96-97-68.zone4.bether e.co.uk 93.96.97.68
        | | Path:
        TK2MSFTNGHUB02. phx.gbl!TK2MSFT NGP01.phx.gbl!T K2MSFTNGP06.phx .gbl
        | | Xref: TK2MSFTNGHUB02. phx.gbl
        | microsoft.publi c.dotnet.framew ork.aspnet:7899 4
        | | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
        | |
        | |
        | | I have a Page which contains an Accordion Control with dynamically
        added
        | | custom panes. I have added a link button to the page to allow
        further
        | panes
        | | to be added and this works. However I also want to be able to remove
        the
        | | panes. I have tried to include this, but find that when I first add
        the
        | pane
        | | the remove event does not get handled, though thereafter it is
        handled
        | | without problems. I would be grateful if someone could take a look
        and
        | | advise why I am getting this problem (I have attached all relevant
        | code).
        | |
        | | Thanks, Richard
        | |
        | |
        | |
        | |
        | >
        |
        |
        |
        >

        Comment

        Working...