Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET Javascript , +
Hi,
 
In my online test site I have placed a timer and a label for displaying countdown time in an update panel. I have placed the next button for displaying the next question outside the update panel.
 
My problem is that the button click is not working with the update panel. Without using the update panel and the timer it works well. How can I solve the problem?
 
I have also tried to place whole tools inside the update panel. It didn't help me.
 
Here is my code:
 
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
 
  <ContentTemplate>
    <table class="style1">
 
        <tr>
            <td class="style2">
 
                <asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick">
                </asp:Timer>
                <asp:Label ID="lblTimer" runat="server"></asp:Label>
 
        </tr>
        <tr>
            <td style="margin-left: 40px" class="style3">
                <asp:Label ID="lblQuestion" runat="server"></asp:Label>
            </td>
        </tr>
        </table>
         </ContentTemplate>
                 </asp:UpdatePanel>
        <table>
        <tr>
            <td style="margin-left: 40px" class="style2">
                <asp:RadioButtonList ID="rblOptions" runat="server">
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td style="margin-left: 40px" class="style2">
                <table class="style1">
                    <tr>
                        <td class="style2">
                            <asp:Button ID="btnNext" runat="server" onclick="btnNext_Click" Text="Next"
                                Width="75px" />
 
                        </td>
                        <td>
 
                            <asp:Button ID="btnFinish" runat="server" onclick="btnFinish_Click"
                                Text="Finish" Width="75px" />
                        </td>
                    </tr>
                    <tr>
                        <td class="style2">
                            &nbsp;</td>
                        <td>
                            <asp:Label ID="lblScore" runat="server">Score : </asp:Label>
                        </td>
                    </tr>
                </table>
 

I added the following code.
<Triggers>
     <asp:AsyncPostBackTrigger ControlID="btnNext" EventName="Click"/>
</Triggers>
 
Still it didn't work. Could you please help me....
 
The selection of radio button is automatically cleared when using update panel. Any help....?
 
Thank you....
Posted 23-Oct-11 20:35pm
Edited 27-Oct-11 1:54am
v8
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can use this
<asp:AsyncPostBackTrigger ControlID="btnNext" />
 
or
 
please provide some code.
  Permalink  
v2
Comments
Neha Thanka at 24-Oct-11 2:26am
   
Sir, I have updated my question with code. Please help me.
AmarSinghRawat at 24-Oct-11 3:04am
   
I am unable to find any problem in your code except missing <td> <tr> and <table> tags.
 
Please paste this code.
 
<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<table class="style1">
<tr>
<td class="style2">
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">

<asp:Label ID="lblTimer" runat="server">
</td>
</tr>
<tr>
<td style="margin-left: 40px" class="style3">
<asp:Label ID="lblQuestion" runat="server">
</td>
</tr>
</table>


<table>
<tr>
<td style="margin-left: 40px" class="style2">
<asp:RadioButtonList ID="rblOptions" runat="server">

</td>
</tr>
<tr>
<td style="margin-left: 40px" class="style2">
<table class="style1">
<tr>
<td class="style2">
<asp:Button ID="btnNext" runat="server" OnClick="btnNext_Click" Text="Next" Width="75px" />
</td>
<td>
<asp:Button ID="btnFinish" runat="server" OnClick="btnFinish_Click" Text="Finish"
Width="75px" />
</td>
</tr>
<tr>
<td class="style2">
</td>
<td>
<asp:Label ID="lblScore" runat="server">Score :
</td>
</tr>
</table>
</td>
</tr>
</table>
AmarSinghRawat at 25-Oct-11 1:43am
   
Have to try this code?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

yes as AmarSingh answered.. you need to register NEXT button to update panel. for registration you need to use <asp:asyncpostbacktrigger xmlns:asp="#unknown"> inside the UpdatePanel
 
i.e.
<updatepanel>
   <contenttemplate>
       ... body ......
   </contenttemplate>
 
  <triggers>
     <asp:asyncpostbacktrigger controlid="btnNext" eventname="Click" />
  </triggers>
<updatepanel></updatepanel></updatepanel>
 

 
Hope it will help you Smile | :)
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

check below.. Use everything in content template
 
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
   <contenttemplate>
 
            <table class="style1">
                <tr>
                    <td class="style2">
                        <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
 
                        <asp:Label ID="lblTimer" runat="server">
                    </td>
                </tr>
                <tr>
                    <td style="margin-left: 40px" class="style3">
                        <asp:Label ID="lblQuestion" runat="server">
                    </td>
                </tr>
            </table>
 

    <table>
        <tr>
            <td style="margin-left: 40px" class="style2">
                <asp:RadioButtonList ID="rblOptions" runat="server">
 
            </td>
        </tr>
        <tr>
            <td style="margin-left: 40px" class="style2">
                <table class="style1">
                    <tr>
                        <td class="style2">
                            <asp:Button ID="btnNext" runat="server" OnClick="btnNext_Click" Text="Next" Width="75px" />
                        </td>
                        <td>
                            <asp:Button ID="btnFinish" runat="server" OnClick="btnFinish_Click" Text="Finish"
                                Width="75px" />
                        </td>
                    </tr>
                    <tr>
                        <td class="style2">
                        </td>
             <td> <asp:Label ID="lblScore" runat="server">Score : </td> </tr> </table> </td> </tr> </table>
 
 </contenttemplate>
 
  <triggers>
     <asp:asyncpostbacktrigger controlid="btnNext" xmlns:asp="#unknown" />
  </triggers>
 
  Permalink  
Comments
Kailash_Singh at 6-Jul-12 6:12am
   
My code is working fine when it is running locally. But after publishing it in web server, its not working....
 
my code is:
<tr><td><asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>

<asp:ListBox ID="lstEmployee" runat="server" Width="200px">
<asp:Button ID="btnMoveRight" runat="server" Text=">>" OnClick="btnMoveRight_Click" />
<asp:Button ID="btnMoveLeft" runat="server" Text="<<" OnClick="btnMoveLeft_Click1" />
<asp:ListBox ID="ddlFor" runat="server" Width="300px" SelectionMode="Multiple">

</td></tr>
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Hi,
If ur using master page than add this code in ur page load event
using AjaxControlToolkit;
 
ToolkitScriptManager objScriptManager = (ToolkitScriptManager)this.Master.FindControl("ScriptManager1");
        objScriptManager.AsyncPostBackTimeout = 36000;
 
I hope it will help
 
Thanks...
  Permalink  
Comments
Neha Thanka at 28-Oct-11 1:35am
   
Thank you sir.....
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

Hey its not the problem with updatepanel
check your code by removing all try catch inside the button...there might be some error...correct it..then it will work fine...I was also having same problem and i corrected it.
  Permalink  
Comments
amruta khare at 8-Oct-12 2:51am
   
i have used update panel in my desgin (aspx) page when i remove update panel at that time its working means text box text is change to respective language but when i put update panel the code is not working means text box language change on page load and on page refresh.but when i change drop down value or click any button event for eg click on reset button or cancel button or update button,it doesnot change the text box language.it remains in english text only this is major problem in my project pls help me out.thanku so much

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



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 13 Jul 2012
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