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
Post a Comment