17 May 2012

Calling Javascript from Server side of the code in Asp.net


Calling Javascript from Server side of the code in Asp.net

Methods:

1. Page.ClientScript.RegisterStartupScript( me.gettype(), "PopupScript", alertScript );

Asynchronous Postback:[If Ajax used in the page]

2. ScriptManager.RegisterStartupScript(this, GetType(), "YourUniqueScriptKey",
        "alert('This pops up');", true);

Parameters
page
Type: System.Web.UI.Page
The page object that is registering the client script block.

type
Type: System.Type
The type of the client script block. This parameter is usually specified by using the typeof operator (C#) or the GetType operator (Visual Basic) to retrieve the type of the control that is registering the script.

key
Type: System.String
A unique identifier for the script block.

script
Type: System.String

The script.
addScriptTags


Type: System.Boolean
true to enclose the script block with < scrip t> and < / script > tags; otherwise, false.

No comments:

Post a Comment

Comments Welcome

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...