0

I wrote this javascript Function :

       function ShowMsg(msg) {
                $.blockUI({
            message: '<div dir=rtl align=center><h1><p>' + msg + '</p></h1></div>',
            css: { 
                border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
            }
        });

        setTimeout($.unblockUI, 2000); 



    }

i want to call this Function Server Side at asp.net :

Page.ClientScript.RegisterClientScriptBlock([GetType](), "script", "ShowMsg(" & "Saved" & ");", True)

But it does not work. the function is work without argument. is there any syntax error exist? thanks

2
  • Check how the server prints your JS code to the client. Commented Nov 29, 2010 at 7:47
  • 1
    Right click in your browser, and click view source. Commented Nov 29, 2010 at 7:51

2 Answers 2

2

'Saved' parameter is missing the quotes

Page.ClientScript.RegisterClientScriptBlock([GetType](), "script", "ShowMsg('" & "Saved" & "');", True)
Sign up to request clarification or add additional context in comments.

Comments

1

These kind of errors you can check through javascript debugging. to enable javascript debugging. go to : tools > intenet options > advanced > browsing and uncheck (disable script debugging). in Internet Explorer Browser . then you can attach debugger by writing debugger; @ any location in javascript function egs:

function ShowMsg(msg) { *

  • debugger;

* $.blockUI({ message: '

' + msg + '

', css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', opacity: .5, color: '#fff' } });

    setTimeout($.unblockUI, 2000); 



}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.