0

In Mainpage...html

<script type="script/javascript">
function SayHi()
{
   alert("Oke.Hai..(waving)!")
}
</script>

and in xaml simpley thereis a button

<button name="Btn" width="100" content="Say 2!" Click="Btn_Click">

</button>

Then in the cs file within the button click event

HtmlPage.Window.Invoke(SayHi); 

Yuyik, a runtime error "Unable to to invoke the method in in click event, Debug ?"

It's simple just that. Any help is appreciated.

2
  • 1
    A script's type should be text/javascript, not script/javascript. Commented Aug 14, 2011 at 8:20
  • 1
    You forgot crucial tag, I've added it for you now. Commented Aug 14, 2011 at 8:22

1 Answer 1

1

You need to wrap the method name with double quotes otherwise it mistakes it as variable name:

HtmlPage.Window.Invoke("SayHi"); 
Sign up to request clarification or add additional context in comments.

1 Comment

Try to follow the steps here then to create the button and attach its onclick event.

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.