Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
<%@ 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 17-Jan-13 2:38am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

<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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 6,434
1 OriginalGriff 6,178
2 Peter Leow 2,534
3 Abhinav S 2,274
4 Maciej Los 2,268


Advertise | Privacy | Mobile
Web04 | 2.8.150414.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2015
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