1

I have a function!

$(document).ready(function() {
  $(".tstInfo").on("click",function(){
       $.toast({
        heading: 'Welcome to my Elite admin',
        text: 'Use the predefined ones, or specify a custom position object.',
        position: 'top-right',
        loaderBg:'#ff6849',
        icon: 'info',
        hideAfter: 3000, 
        stack: 6
      });

 }); });

I want to call it from code behind in asp.net please tell me how to do it. Thanks in advance

5
  • Have a look at $.ajax in the jQuery docs Commented Mar 16, 2018 at 11:17
  • When do you want to call it? on load? Commented Mar 16, 2018 at 11:18
  • @Eddi = $ajax is helpful when you want to call from client to server , but from server to client its not possible with it Commented Mar 16, 2018 at 11:21
  • @hardkoded yeah on load Commented Mar 16, 2018 at 11:36
  • In what situation do you want it to be called? Commented Mar 16, 2018 at 12:24

1 Answer 1

2

you can try like this

protected void BtnClick(object sender, EventArgs e)
{
  ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "id", 
      "<script language='javascript'> $('.tstInfo').click();</script>", true);            

}
Sign up to request clarification or add additional context in comments.

1 Comment

you probably forgot to escape the double quotes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.