Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i have question about update panel and triger asociated with it.
I have repeater control in update panel and one user control(having button) out side the update panel. now i want when i click on button which is in user control, my repeater is being is refreshed. how can i do this? follwing is my code

//user control
<uc1:myUserContrl ID="usercontrol"  runat="server"/>

//update panel and repeater control
<asp:updatepanel ID="updReater" runat="server">
  <contenttemplate>
     here is my repeater control
  </contenttemplate>
</asp:updatepanel>
Posted

Suppose you have scriptmanager with ID "ScriptManager1" on your page, write the following code in Page Load event:
C#
ScriptManager1.RegisterAsyncPostBackControl(usercontrol1.FindControl("Button1"));//Button1 is the ID of button inside your user control.

Also, you should set "UpdateMode" property of the update panel to "Conditional".
 
Share this answer
 
Well, you can use a Trigger for your Update Panel & do the Needful.
I'm just adding the Code for Trigger below:

ASP.NET
<asp:updatepanel id="updReater" runat="server">
   <contenttemplate>
      Here is your repeater control
   </contenttemplate>
   <triggers>
      <asp:asyncpostbacktrigger controlid="Button1" eventname="Click" />
   </triggers>
</asp:updatepanel>


In the above lines of code I'm considering your Button Id as 'Button1' & Targeting it's 'Click' event for Async Postback.

So Just add these few lines of Code & your job will be done.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900