From a User Control, how do I update UpdatePanel?

silemone
silemone used Ask the Experts™
on
I have a .aspx page that holds some data that should be updated (therefore data is housed in an UpdatePanel) when my user control parameters are changed.

Basically, how do I update  the  UpdatePanel in the aspx page that hold the .ascx (user control)?

My code is written in VB.NET
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David RobitailleAnalyst Programmer

Commented:
the user control is inside the update panel?
if yes, you could just set children as trigger to true or add the  user control`s ID in the asyncpostback trigger list.
If you need more help doing this, please send some code form the aspx

Author

Commented:
no, unfortunately...its outside of the Updatepanel
David RobitailleAnalyst Programmer

Commented:
ok, then just add the user control`s ID in the asyncpostback trigger list of the update panel
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Author

Commented:
oops...this is a user control, meaning it was created...all postbacks appear to be generated in the .ascx (user control page) page...not in the aspx page...
David RobitailleAnalyst Programmer

Commented:
I got difficulty to understand what you are talking about... I know what a usercontrol is and all, but how are you using it; you are creating it dynamically (from code) or add it in the aspx???
It will all be easier if you post some code....

Author

Commented:
ok.


In this example...I have a user control...can be a update button and a textbox...

on click of update, make in the aspx below, in the label  = the same as the textbox from the user control.
<table class="FormTable" cellspacing="0" cellpadding="0" width="600" align="center">
    <tr>
       <td colspan="3"><uc1:ReplicationSettings ID="ReplicationSettings1" runat="server" Visible="false" />
    </tr>				
</table>
<asp:UpdatePanel ID="uPanelGrid" runat="server" UpdateMode="Conditional">
   <ContentTemplate>
	<asp:label" id="label" runat="server">
   </ContentTemplate>
</aspx>

Open in new window

David RobitailleAnalyst Programmer

Commented:
ok, you ReplicationSettings control should raise an event when he is updtead. so just to be sure we will leave the event name of the trigger blank.
ther is  no reason for this to dont work :
http://stackoverflow.com/questions/448287/how-to-add-trigger-to-updatepanel-where-the-event-for-trigger-is-inside-a-user-co
 

<table class="FormTable" cellspacing="0" cellpadding="0" width="600" align="center">
    <tr>
       <td colspan="3"><uc1:ReplicationSettings ID="ReplicationSettings1" runat="server" Visible="false" />
    </tr>				
</table>
<asp:UpdatePanel ID="uPanelGrid" runat="server" UpdateMode="Conditional">
    <Triggers>
                              <asp:AsyncPostBackTrigger ControlID="ReplicationSettings1" />
                         </Triggers>
 
   <ContentTemplate>
	<asp:label" id="label" runat="server">
   </ContentTemplate>
</aspx>

Open in new window

Analyst Programmer
Commented:
ok i think i understand, what is the problem:
Your usercontrol should Raise an event, so you could handle that event in the aspx page to update the updatepanel from the usercontrol`s properties...

Author

Commented:
I added an event handler, raised an event and it worked perfectly...thanks for help...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial