RegisterScriptBlock - Can Script Blocks Be Read / Accessed?

Discussion in 'ASP .Net' started by Michael A. Vickers, Nov 24, 2004.

  1. Hi,

    Does anybody have a method by which they can read script blocks that have been
    registered via RegisterScriptBlock or RegisterStartupScript? I'd like to
    manipulate registered script blocks prior to them being rendered to the
    client.

    Thank you.


    Michael
     
    Michael A. Vickers, Nov 24, 2004
    #1
    1. Advertisements

  2. I'd like to put a stamp on my envelope after I've mailed it. Unfortunately
    for both of us, that isn't possible. What you CAN do is manipulate the
    string that the RegisterClientScriptBlock method is going to register prior
    to registering it.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Neither a follower
    nor a lender be.
     
    Kevin Spencer, Nov 24, 2004
    #2
    1. Advertisements

  3. Michael A. Vickers

    bruce barker Guest

    no. but on your base page, you can override it with one that does.

    string mClientStartupScript = new NameValueCollection();

    public string GetClientScriptBlock(string key)
    {
    return mClientStartupScript[key];
    }
    public override void RegisterClientScriptBlock(string key, string script)
    {
    mClientStartupScript[key] = script;
    base.RegisterClientScriptBlock(key, script);
    }



    | Hi,
    |
    | Does anybody have a method by which they can read script blocks that have
    been
    | registered via RegisterScriptBlock or RegisterStartupScript? I'd like to
    | manipulate registered script blocks prior to them being rendered to the
    | client.
    |
    | Thank you.
    |
    |
    | Michael
    |
    | --
    | Have a round and remember things we did that weren't so tender,
    | Let the train blow the whistle when I go... -JC
     
    bruce barker, Nov 24, 2004
    #3
  4. Brilliant. That was so simple I'm ashamed I didn't think of that myself. Thank
    you very much.


    Michael
     
    Michael A. Vickers, Nov 25, 2004
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.