I have to convert this code in Asp.Net C# codebehind
js function in the Silverlight code-behind MainPage.xaml.cs file, using the click event of a button.
private void btn_Click(object sender, RoutedEventArgs e)
{
string DatabaseId = "99999999999999999999";
string UserName = "user";
string Password = "pass";
HtmlPage.Window.Invoke("login", DatabaseId, UserName, Password);
}
I'm not well experienced on this, but based on answers to this question , you can try using ScriptManager.RegisterClientScriptBlock to invoke javascript function from ASP.NET code behind. Something like this :
private void btn_Click(object sender, RoutedEventArgs e)
{
string DatabaseId = "99999999999999999999";
string UserName = "user";
string Password = "pass";
string script = string.Format("login({0}, {1}, {2});", DatabaseId, UserName, Password);
ScriptManager
.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), "login", script, true);
}
and another reference, a question on how to invoke script with parameters here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.