Thursday, February 25, 2010

TODO:Calling javascript function from silverlight page. 26/02/2010

function alertText(text) {
alert(text);
}

function sendText() {
return "Hi from Javascript!";
}
The JavaScript code shown above is as basic as it gets, but the interesting part is not the JavaScript itself but how to call it from Silverlight. Open the Silverlight project and add the following xaml to the Page.xaml file:

















TODO:To avoid page load on calling a event from javascript in ASP.net


function OnClickMyButton()
{
__doPostBack('', 'MyButtonClick'); // this will post back the page with the argument specified
}

now in ur code file in Page_Load u have to catch that post back and argument like:

If (Me.Request.Params("__EVENTARGUMENT") = "MyButtonClick") Then

Call MyButton_Click()

End If

No comments:

Post a Comment