By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,763 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,763 IT Pros & Developers. It's quick & easy.

nested update panel and gridview events

P: 12
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 childrenAsTriggers 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
Expand|Select|Wrap|Line Numbers
  1.                 1) Inner update panel's trigger
  2.                     <Triggers>
  3.                         <asp:AsyncPostBackTrigger ControlID="GridView2" EventName="RowCommand" />
  4.                     </Triggers>
  5.                 2) Outer update panel's trigger
  6.  
  7.           <Triggers>
  8.             <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="RowCommand" />
  9.         </Triggers>
------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1.  <asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
  2.     <ContentTemplate>
  3.      <asp:GridView ID="GridView1" ....  OnRowCreated="GridView1_RowCreated" OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand">
  4.  
  5.                      ....
  6.                           ..
  7.  
  8. <td>
  9.  
  10.                              <asp:UpdatePanel ID="up2" runat="server" UpdateMode="Conditional">
  11.                              <ContentTemplate>
  12.                               <asp:GridView ID="GridView2" .... OnRowCreated="GridView2_RowCreated" OnRowDataBound="GridView2_RowDataBound" OnRowCommand="GridView2_RowCommand">
  13.  
  14.                               <asp:GridView ID="GridView3" ....>
  15.                               </asp:GridView>
  16.                               </asp:GridView>
  17.                              </ContentTemplate>
  18.                              </asp:UpdatePanel>
  19.  
  20. </td>
  21.  
  22. .....
  23.  
  24.      </asp:GridView>
  25.  
  26.  </ContentTemplate>
  27. </asp:UpdatePanel>


Please someone help

thanks in advance.
Nov 14 '11 #1
Share this Question
Share on Google+
2 Replies


Frinavale
Expert Mod 5K+
P: 9,731
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
Nov 17 '11 #2

P: 12
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,deleting. 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!
Nov 21 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.