Click here to Skip to main content
12,064,855 members (42,282 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
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 17-Jan-13 0:28am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Suppose you have scriptmanager with ID "ScriptManager1" on your page, write the following code in Page Load event:
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".
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Well, you can use a Trigger for your Update Panel & do the Needful.
I'm just adding the Code for Trigger below:

<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.
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160204.4 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100