registerclientscriptblock - Asp.net: How to call a javascript function at the end of button click code behind -


my motto call java script function @ end of button click code behind. ie, firstly need execute server side function after java script function should invoked.

my server side method follows

protected string saveembedurl_click()

{

    if (txtembedurl.text != null)     {         school aschool = new school();         aschool.schoolid = currentschool.schoolid;         aschool.embedurl = txtembedurl.text;         schoolrespository.updateembedurl(aschool);         return "true";     } 

}

my java script function follows

function saveembedurlclientside() {

admin_customizetheme.saveembedurl_click(true); $('#lbl_embedcode').removeclass('hide').addclass('show'); $('#embedcode').removeclass('hide').addclass('show'); copytoclipboard("embedcode"); 

}

how can achieve this?

thanks.

i'm pretty sure need add this

registerstartupscript("yourjavascript", "saveembedurlclientside()");

"yourjavascript" arbitrary string used identify javascript.

here's relevant msdn article.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -