Click here to Skip to main content
11,806,931 members (64,116 online)
Rate this: bad
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">
     here is my repeater control
Posted 16-Jan-13 23:28pm
Rate this: bad
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".
Rate this: bad
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">
      Here is your repeater control
      <asp:asyncpostbacktrigger controlid="Button1" eventname="Click" />

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.

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

  Print Answers RSS
0 ppolymorphe 225
1 Afzaal Ahmad Zeeshan 165
2 OriginalGriff 150
3 George Jonsson 145
4 CPallini 100
0 OriginalGriff 3,405
1 Maciej Los 1,990
2 CPallini 1,955
3 KrunalRohit 1,907
4 ppolymorphe 1,407

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2015
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