How to define the Type parameter in ClientScript.RegisterClientScriptBlock? Thank


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to define the Type parameter in ClientScript.RegisterClientScriptBlock? Thank

  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, 11:24 PM
  2. VB/C Array parameters
    By Gastao Woelfert in forum VB Classic
    Replies: 2
    Last Post: 09-01-2000, 12:36 PM
  3. VB/C Array parameters
    By Gastao Woelfert in forum VB Classic
    Replies: 0
    Last Post: 09-01-2000, 09:59 AM
  4. resize a picture or image box
    By Rally in forum VB Classic
    Replies: 2
    Last Post: 06-30-2000, 02:10 PM
  5. Adding Columns to comboboxes through API
    By Lori Taylor in forum VB Classic
    Replies: 20
    Last Post: 06-14-2000, 12:06 PM

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center