DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    37

    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-------------------------------

  2. #2
    Join Date
    Oct 2005
    Posts
    1
    simply use..
    typeof (Page)

Similar Threads

  1. What is the UDT?
    By Tahui in forum VB Classic
    Replies: 2
    Last Post: 11-22-2000, 10:24 PM
  2. VB/C Array parameters
    By Gastao Woelfert in forum VB Classic
    Replies: 2
    Last Post: 09-01-2000, 11:36 AM
  3. VB/C Array parameters
    By Gastao Woelfert in forum VB Classic
    Replies: 0
    Last Post: 09-01-2000, 08:59 AM
  4. resize a picture or image box
    By Rally in forum VB Classic
    Replies: 2
    Last Post: 06-30-2000, 01:10 PM
  5. Adding Columns to comboboxes through API
    By Lori Taylor in forum VB Classic
    Replies: 20
    Last Post: 06-14-2000, 11:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links