Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<%@ Page Language="C#" MasterPageFile="~/OnlineExam/ExamMaster.master" AutoEventWireup="true" CodeFile="StartExam.aspx.cs" Inherits="StartExam" %>

<%--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">--%>


<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <head>
    <title>Online Examination</title>
     <script type="text/javascript" language="javascript">
         function fun1() {
             alert("TimeOut!");
             window.location = "Result.aspx";
         }
</script>
</head>

    <body>
    <form id="form1">
    <asp:ScriptManager ID="ScriptManager1" runat="server"/>
    <div>

      <table align="right">
        <tr>
        <td>
        <asp:Timer ID="tim1" runat="server" OnTick="Timer1_Tick" Interval="1000"
        Enabled="False"  ></asp:Timer>

      <asp:UpdatePanel ID="up1" runat ="server" UpdateMode="Conditional" >
         <ContentTemplate>
          <asp:Label ID="label_time" runat="server" ></asp:Label>
         </ContentTemplate>
        <Triggers>
         <asp:AsyncPostBackTrigger ControlID="tim1" EventName="Tick"/>
        </Triggers>
      </asp:UpdatePanel>
        </td>
        </tr>
        </table>

    <table align="center">
    <tr>
    <td>
    Welcome&nbsp;
         <asp:Label ID="lblname" runat="server"></asp:Label>
        <br/>
    Subject:
        <asp:Label ID="lblsub" runat="server"></asp:Label>
        <br/>

    </td>
    </tr>
    </table>


    <table>
    <tr>
     <td style="width: 97px">

        <asp:Label ID="lblqno" runat="server"></asp:Label>

        <asp:Label ID="lblQue" runat="server"></asp:Label>
        <br />
        <asp:RadioButtonList ID="rbtl" runat="server"
            onselectedindexchanged="rbtl_SelectedIndexChanged" >
           <asp:ListItem Text ="" Value ="Rd1" > </asp:ListItem>
           <asp:ListItem Text ="" Value ="Rd2"> </asp:ListItem>
           <asp:ListItem Text ="" Value ="Rd3"> </asp:ListItem>
           <asp:ListItem Text ="" Value ="Rd4"> </asp:ListItem>
        </asp:RadioButtonList>

&nbsp;<asp:LinkButton ID="lnkNxt" runat="server" onclick="lnkNxt_Click"
             ForeColor="#FF66CC" style="font-size:medium" Width="82px"><h2>Next</h2></asp:LinkButton>
         &nbsp;&nbsp;

        <asp:Panel ID="pnl" runat="server" style="color:red">
        </asp:Panel>
        <br />
        <asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click"
            Text="Submit" Visible="False" />
            </td>
           </tr>
      </table>

    </div>

    </form>
</body>

</asp:Content>


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

</asp:Content>

<%--</html>--%>
Posted

If you only want to refresh a part of the page rather than all of it, then you need to look at asynchronous methods such as AJAX/JSON:


Ajax Tutorial for Beginners: Part 1[^]

and:

Ajax Tutorial for Beginners with XML & JSON: Part 2[^]
 
Share this answer
 
ASP.NET
<asp:UpdatePanel ID="up1" runat ="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:Label ID="label_time" runat="server" ></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="tim1" EventName="Tick"/>
</Triggers>
</asp:UpdatePanel>


The above code you are using will update only the content wrapped inside the update panel. The control that changes the question(next button) is located outside this update panel. So, that is causing the postback to update all the contents. You should wrap the contents to be updated asynchronously inside this update panel or you can use another update panel. That way the updation will become smooth and flicker free and only the contents inside the update panel will be updated.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900