Page.ClientScript with master page

In VS2005 ASP.NET 2.0 sqlserver 2000:
I use the following function to show error messages in my site:

public void ShowMessage(string keymsg)
      string myScript = @"alert('this is my message)";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
but when I use it in a slave of a master page, it gives an error.
Do I have to define it in the master page ? and how to call it?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

public void ShowMessage(string keymsg)
      string myScript = @"<script language='javascript'>alert('this is my message)</script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
>> 'this is my message << needs to be: 'this is my message'
aki4u is correct..  

Hey SuperGhosty.

You are correct that you need the script tags, but  the last boolean on startupscript; when set to true will gen that for you.

This should work
string myScript = @"alert('this is my message;);";

I just tested it in a master page and it works great.

If this worked, please give pnts to aki4u as he mentioned it 1st. Im just bored and thought I would comment on the issue.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

thats right, i just quickly glanced at the code and was used to ASP.NET 1.1 - which does not have the extra params so you must include the script tag.
ANAT2403Author Commented:
Jojo1771 is almost correct
this is the solution:
  string myScript = @"alert('this is a message');";

the second tag ' in    - this is a message I forgot to put here but in my program it existed.
the problem was with the ; sign that I didn't know I have to add
Thankyou all.
hmmm...I don't see any points here
ANAT2403Author Commented:
because you didn't mention the sign of semicolon ; which was the only problem here.
The closing tag you mention was something I forgot to write in expert exchange but not in the program
don't you use copy-paste???
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.