Reputation: 15190
I'm using Telerik controls in my project and I am using RadTabStrip for my purposes
<telerik:RadTabStrip ID="tsRequisitions" Skin="" MultiPageID="mpRequisitions" runat="server" Width="980" ScrollButtonsPosition="Right" ScrollChildren="True" OnTabCreated="tabCreated">
As you can see in this template I call tabCreated
method every time when new tab has created. Now I want to call some javascript function from server-side(all mentioned is in RadAjaxPanel).
I've tried to use RegisterClientScriptBlock
, but it didn't help me to fire my javascript function.
if (!ClientScript.IsClientScriptBlockRegistered("tabSelected"))
{
ClientScript.RegisterClientScriptBlock(this.GetType(),
"tabSelected", "TabSelected();", true);
}
And I have this in my .aspx
file
<script type="text/javascript">
function TabSelected() {
console.log("dfgdfgfdg");
}
</script>
How can I call my function from code-behind after AJAX postback?
Upvotes: 2
Views: 6011
Reputation: 15190
The following code snippet do the trick
RadScriptManager.RegisterStartupScript(this,this.GetType(), "tabSelectedScript", "TabSelected();", true);
RegisterStartupScript
is static method of RadScriptManager
class (I'm using Telerik controls here again, but maybe it will work with asp.net standart ScriptManager too).
Upvotes: 4
Reputation: 9561
Have you tried this ?
Page.RegisterStartupScript("OnLoad", "<script>TabSelected();</script>");
Upvotes: 0