Link to home
Start Free TrialLog in
Avatar of silemone
silemoneFlag for United States of America

asked on

From a User Control, how do I update UpdatePanel?

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
Avatar of David Robitaille
David Robitaille
Flag of Canada image

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
Avatar of silemone

ASKER

no, unfortunately...its outside of the Updatepanel
ok, then just add the user control`s ID in the asyncpostback trigger list of the update panel
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...
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....
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

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

ASKER CERTIFIED SOLUTION
Avatar of David Robitaille
David Robitaille
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I added an event handler, raised an event and it worked perfectly...thanks for help...