views:

320

answers:

1

hi,

I have a page and on that page i have a button and a user control. I want to refresh the user control without refreshing the page.

I know i cannot do it otherwise so i did is... (wrapped my user control inside the Update Panel.)

<asp:TextBox ID="txtName" runat="server"></asp:TextBox><br />
<asp:Button ID="btnAdd" runat="server" Text="Add name to list" OnClick="btnAdd_Click" /><br /><br />

<asp:UpdatePanel ID="upShowNames" runat="server">
 <ContentTemplate>
     <uc1:ShowNames ID="ucShowNames" runat="server" />
 </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnAdd" />
    </Triggers>
</asp:UpdatePanel>

but i still the control wont refresh. i also tried calling the update panels .Update() method by changing its UpdateMode to Conditional but that does not work either...

does any one know how can we do it then...

any help will be greatly appreciated....thank you!!

+1  A: 

Please change these 2 things

<asp:UpdatePanel ID="upShowNames" runat="server" UpdateMode="Conditional">

<asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click"/>

You missed the EventName on the postback trigger, once you add that, it should work :-)

Claudio Redi
hey buddy thanks for the help but i have already mentioned that i did try with the UpdateMode= Conditional thingi...and it did not work...any other suggestions ??
Shrewdy
Please, read the complete description. The main thing you have missed is EventName="Click" on the AsyncPostBackTrigger
Claudio Redi