Click here to Skip to main content
15,748,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how i can close the greybox using Button server control
Prerak Patel 9-Feb-11 3:58am    
What you have tried so far?!
spydeehunk 9-Feb-11 6:16am    
Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "this.parent.GB_hide();", true);
i have put code mention above in button server control but its nt wrking

1 solution

If you mean the same Greybox as I do then you might want to try this:

var GB = function(caption, /* optional */ height, width, callback_fn) {
    var options = {
        caption: caption,
        height: height || 500,
        width: width || 500,
        fullscreen: false,
        show_loading: false,
        callback_fn: callback_fn
    var win = new GB_Window(options);
    return win;

The above code is in a script tag on your page. GB is a global variable that now holds a reference to the greybox. So it's easy to do stuff like this with it:

C#; // show the box
GB.hide();        // hide the box

The button should call javascript GB.hide() in order to close the greybox.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900