Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How to call button's click event without clicking that actual button in ASp.NET C#

$
0
0

hello every one.. I am trying to develop online test....

my need is after some second, question must be changed..

so i have used ajax timer control.... the code is as below

public partial class Examination : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {

        if (!Page.IsPostBack)
        {

                         // code to load first question of test...
        }
    }


    protected void timer1_Tick(object sender, EventArgs e)
    {
        int sec;
        sec = Convert.ToInt32(Session["sec"].ToString());
        sec = sec - 1;
               
        if (sec < 0)
        {

            //Response.Redirect("Results.aspx"); this statement works preety good
            //btnNext_Click(this, null); this statement is not working, instead of this statement I have used "fun();" and btnNext(null,null)
          //but both are not working.....
            sec = 10;
            Session["sec"] = sec.ToString();
        }
        Session["sec"] = sec.ToString();
        lblScnds.Text = sec.ToString();               
    }

    public void fun()
    {

        //code to fetch next question from DB
    }


    protected void btnNext_Click(object sender, EventArgs e)
    {
        fun();
    }

// i have used btnNext.Click(null,null) or (this,null)&nbsp; but they doesn't work</p> <p>

// i have made sub, that i call when button is clicked, same call i made when seconds become zero, but there it doesn't work..

// Whats actual problem... can anybody say.. please..


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>