I've created a C# Desktop Application which depends on web crawler idea.
I made my application using web browser control to open a website and login progmatically and redirect to the specific page which have a gridview with all user's data that I want to collect...
But the issue here username in the gridview click fired by JavaScript function. I know its name but not how to call it inside desktop application.
What are the namespaces or DLLs that would allow me to do so?
I think this should help you out:
http://www.west-wind.com/WebLog/posts/493536.aspx
EDIT: Based on that link, here's a small sample app. Add a Button and a WebBrowser control to a Windows Form and add this code:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.webBrowser1.DocumentText = @"<html>
<body>
<script type = ""text/javascript"">
function ShowMessage(text) {
alert(text);
}
</script>
</body>
<input type=""button"" onclick=""ShowMessage('From JavaScript')"" value=""Click me""/>
</html>";
}
private void button1_Click(object sender, EventArgs e)
{
this.webBrowser1.Document.InvokeScript("ShowMessage",new object[]{"From C#"});
}
}
If you click the button in the browser, it'll show the javascript message, if you click the button in the windows form, it'll show the C# message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With