Call server side Method from JavaScript after Timer count down end in ASP.Net

Last Reply one year ago By dharmendr

Posted one year ago

Hi Developers,

I am creating a Exam page . so i want to put a timer on my page , i have tried lots using c#,but no one is working exactly. si i am added timer using javascript code . i have to call c# function from javascript when the time countdown is 0.

i have done and working but i dont know how to call C# server side Function from javascript .

my html code

 Session Time <span id="countdown">10</span> seconds

my javascript code 

<script type="text/javascript">

    // Total seconds to wait
    var seconds = 3;

    function countdown() {
        seconds = seconds - 1;
        if (seconds < 0) {
            // Chnage your redirection link here        
            window.location = "test.aspx";
        } else {
            // Update remaining seconds
            document.getElementById("countdown").innerHTML = seconds;
            // Count down using javascript
            window.setTimeout("countdown()", 1000);

    // Run countdown function


my C# code

protected void Page_Load(object sender, EventArgs e)

    public void MyName(object sender, EventArgs e)
    public void name()
        lbl.Text = "Paul Raj";

i need to bind the C# MyName() function and Display the name "Paul Raj" after the countdown end .am trying , if anyone know this kindly help me to done this module , this is the last module of my project.


thanking you


'man becomes what he thinks about'

This question does not have replies that have been liked.