1

I need to do btnRate_Click after particular time on javascript/jquery

protected void btnRate_Click(object sender, EventArgs e) 

      {
        if (Session["User"] != null && Session["ActiveDoctor"] != null)
        {                 
            if (objRate.InsertRecord())
                Response.Redirect("../Clinics.aspx", true);
         }
     }

Please help....

RAS
  • 8,100
  • 16
  • 64
  • 86
Naief M
  • 35
  • 8

1 Answers1

2

Assuming there's a button which has a click event which is tied to btnRate_Click, you can use __doPostback to trigger the post back.

This means you could do something like:

window.setTimeout(function() { __doPostback('<%= btnRate.UniqueID %>', '');}, 1000);

This should 'click' btnRate 1 second after calling the code.

See the following question for more info on __doPostback:

How to use __doPostBack()

Community
  • 1
  • 1
Ian Newson
  • 7,679
  • 2
  • 47
  • 80
  • "Assuming there's a button which has a click event which is tied to btnRate_Click" please explain this. – Naief M Jun 20 '12 at 07:03
  • You haven't shown us your markup, but it looks like it contains something like ``. All I meant is that I've assumed this to be true for the purpose of my response. – Ian Newson Jun 20 '12 at 07:13