Click here to Skip to main content
Rate this: bad
good
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 16-Jan-13 23:28pm
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
0 Sergey Alexandrovich Kryukov 568
1 OriginalGriff 384
2 George Jonsson 258
3 Abdul Samad KP 135
4 Animesh Datta 130
0 OriginalGriff 6,099
1 Sergey Alexandrovich Kryukov 5,411
2 CPallini 4,770
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2014
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