5
Answers

UpdatePanel Not works fine

Nilesh Patil

Nilesh Patil

7y
187
1
Hi,
 
When I use Button inside Update panel it doesnot fire click event but outside the update panel it works.
 
here is the code
  1. <asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional"  
  2. ChildrenAsTriggers="true">  
  3. <ContentTemplate>  
  4. <asp:Button ID="LinkButton1" runat="server" class="btn btn-primary" Style="color: #fff; background-color: #337ab7; border-color: #2e6da4; display: inline-block; padding: 6px 8px; margin-bottom: 0; border: 1px solid transparent; border-radius: 4px;"  
  5. OnClick="LinkButton1_Click" Text='<%#Eval("Row#") %>' />  
  6. </ContentTemplate>  
  7. <Triggers>  
  8. <asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />  
  9. </Triggers>  
  10. </asp:UpdatePanel>
Answers (5)
0
Nilesh Patil

Nilesh Patil

NA 3.4k 7k 7y
Hi Gautam,
 
I am trying 
 
  1. protected void LinkButton1_Click(object sender, EventArgs e)
  2. {
  3. Label1.Text = "Click Worked";
  4. }
 
 
code but system gives error label1 does not exist in current context 
and when i am given label outside panel so its work fine how can i fixed it 
 
 
0
Nilesh Patil

Nilesh Patil

NA 3.4k 7k 7y
Actually i am dispay another web form in an iframe on button click event
 
I am confused where is problem and where need to apply proper update panel in aspx page 
0
Gautam Parmar

Gautam Parmar

NA 872 2.2k 7y
Code is working fine but the effect will be inside the update panel ,
 
If your click event changes the code of Outside Update panel UI it will not show you in  UI But in Backend is working.
 
SO you have to code it into update panel 
0
Nilesh Patil

Nilesh Patil

NA 3.4k 7k 7y
Hi Gautam
 
Thanx for reply
 
But my side code is not work, Is there problem in my webform? beacause i use webform with master page 
0
Gautam Parmar

Gautam Parmar

NA 872 2.2k 7y
  1. <form id="form1" runat="server">  
  2.         <div>  
  3.             <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>  
  4.             <asp:UpdatePanel ID="updatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">  
  5.                 <ContentTemplate>  
  6.                     <asp:Button ID="LinkButton1" runat="server" class="btn btn-primary" Style="color: #fff; background-color: #337ab7; border-color: #2e6da4; display: inline-block; padding: 6px 8px; margin-bottom: 0; border: 1px solid transparent; border-radius: 4px;"  
  7. OnClick="LinkButton1_Click" Text='<%#Eval("Row#") %>' />  
  8.                     <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>  
  9.                 </ContentTemplate>  
  10.                 <Triggers>  
  11.                     <asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />  
  12.                 </Triggers>  
  13.             </asp:UpdatePanel>  
  14.             <br />  
  15.         </div>  
  16.     </form>  
There is no issue in Code, is Working Fine Inside click event there is code 
  1. protected void LinkButton1_Click(object sender, EventArgs e)  
  2.         {  
  3.             Label1.Text = "Click Worked";  
  4.         }  
 And Here is result