-
How to define the Type parameter in ClientScript.RegisterClientScriptBlock? Thank
How to define the Type parameter in ClientScript.RegisterClientScriptBlock? Thanks!
When I run the code Part 1, I get a alert information:
'System.Web.UI.Page.RegisterClientScriptBlock(string, string)' is obsolete: 'Use ClientScript.RegisterClientScriptBlock(string key, string script) instead. http://go.microsoft.com/fwlink/?linkid=14202'
So I have to replace the code with Part 2, but whenI run the code Part 2, I get a error information
Value cannot be null.
Parameter name: type
The I first parameter is Type value in ClientScript.RegisterClientScriptBlock function.
but I don't know how to pass a value to the first parameter, could you help me?
//--------------------Part 1-------------------------------
public void ShowMessage(string input) {
string strScript;
strScript =@"<script language=javascript> ";
strScript = strScript + "alert('"+input+"')";
strScript = strScript + @"</script>";
RegisterClientScriptBlock("clientScript", strScript);
}
protected void Button1_Click(object sender, EventArgs e)
{
ShowMessage("cw");
}
//--------------------Part 1-------------------------------
//--------------------Part 2-------------------------------
public void ShowMessage(string input) {
string strScript;
strScript =@"<script language=javascript> ";
strScript = strScript + "alert('"+input+"')";
strScript = strScript + @"</script>";
ClientScript.RegisterClientScriptBlock(null,"clientScript", strScript);
}
//--------------------Part 2-------------------------------
-
simply use..
typeof (Page)
Similar Threads
-
By Tahui in forum VB Classic
Replies: 2
Last Post: 11-22-2000, 10:24 PM
-
By Gastao Woelfert in forum VB Classic
Replies: 2
Last Post: 09-01-2000, 11:36 AM
-
By Gastao Woelfert in forum VB Classic
Replies: 0
Last Post: 09-01-2000, 08:59 AM
-
By Rally in forum VB Classic
Replies: 2
Last Post: 06-30-2000, 01:10 PM
-
By Lori Taylor in forum VB Classic
Replies: 20
Last Post: 06-14-2000, 11:06 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks