nested update panel and gridview events

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dha lak
    New Member
    • Oct 2011
    • 12

    nested update panel and gridview events

    Hi,



    I use 2 update panels, nested with each other
    1st update panel contains GridView1
    2nd update panel contains GridView2. Gridview2 contains GridView3. But GridView3 just displays data. It has no rowcommand or any events.

    My problem is when a button in GridView2 is clicked. both GridView1 and GridView2's rowcommand event are fired. But, i do not want the GridView1's Rowcommand event to fire.

    Is it possible using update panel.
    How do i achieve it. Please do help me asap.

    I set updatemode to conditional for both up1 & up2 -> did'nt work.
    I set updatemode to conditional, and childrenAsTrigg ers for both up1 & up2 -> did'nt work.

    I set updatemode to conditional for both up1 & up2 and defined the trigger for up1 alone -> did'nt work
    I set updatemode to conditional for both up1 & up2 and defined the trigger for up2 alone -> did'nt work
    I set updatemode to conditional for both up1 & up2 and defined the triggers for both -> did'nt work.

    ------------------------------------------------------------------------------------------------

    These are the triggers i tried
    Code:
                    1) Inner update panel's trigger
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="GridView2" EventName="RowCommand" />
                        </Triggers>
                    2) Outer update panel's trigger
    
              <Triggers>
                <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowCommand" />
            </Triggers>
    ------------------------------------------------------------------------------------------------
    Code:
     <asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
         <asp:GridView ID="GridView1" ....  OnRowCreated="GridView1_RowCreated" OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand">
    
                         ....
                              ..
    
    <td>
    
                                 <asp:UpdatePanel ID="up2" runat="server" UpdateMode="Conditional">
                                 <ContentTemplate>
                                  <asp:GridView ID="GridView2" .... OnRowCreated="GridView2_RowCreated" OnRowDataBound="GridView2_RowDataBound" OnRowCommand="GridView2_RowCommand">
    
                                  <asp:GridView ID="GridView3" ....>
                                  </asp:GridView>
                                  </asp:GridView>
                                 </ContentTemplate>
                                 </asp:UpdatePanel>
    
    </td>
    
    .....
    
         </asp:GridView>
    
     </ContentTemplate>
    </asp:UpdatePanel>


    Please someone help

    thanks in advance.
    Last edited by Frinavale; Nov 17 '11, 02:35 PM. Reason: Added code tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    When an UpdatePanel submits a request to a server the whole page is sent to the server: Always.

    The full ASP.NET life cycle is executed and a response is generated.

    Then upon returning the HTML to the browser, the content is stripped down so that it is only the content that is within the UpdatePanel.

    It won't matter what you do to try to get around this, your events are always going to fire.

    -Frinny

    Comment

    • dha lak
      New Member
      • Oct 2011
      • 12

      #3
      Thanks a lot

      1) Can you plz suggest me an alternative solution then?


      2) --- I also have a doubt. I have a update panel with just a gridview, with inline editing,deletin g. It is a very simple page. Outside the update panel are just 2 controls: a search textbox and a button. On clicking the button, textbox is not getting cleared. (in the txtBox_Click event handler). so i wrote a jquery function to clear the textbox's value.


      --- Same problem(in a different aspx page), when i try to set the dropdownlists's selected index to 0(from the gridview's editing or updating event handler). These ddls are outside the update panel. Inside the Updatepanel is just a single gridview.

      Can you plz provide some explanation for this.

      Thanks in advance!

      Comment

      Working...