0

I have a javascript function which I want to send to c#.

The c# function will then send that information to the fiscal printer.

The function will get elements id from html document.

The function looks like this

function senddata(price)
{
  priceElem=document.getElemById("price");
}

I want to send data to c# function which will be printing. I have a file that is created by .net which I want to include in my c# function.

This .dll file will connect to the fiscal printer and c# function. The .dll will help in communicating between the program and the fiscal printer. The html and javascript is retrieving this information in another program. I am using incotex fiscal printer. This c# program will be printing the receipt. Someone out there please help.

Regards, masiela

5
  • Is this JavaScript running in a webbrowser? IE? Can you run in it the WebBrowser control? Commented Apr 14, 2012 at 9:13
  • See these: stackoverflow.com/questions/1905716/… Commented Apr 14, 2012 at 9:21
  • @Haroldis That's entirely different... it's just for ASP.NET reconstruction. In any case, I'm not sure why this is being closed as "not constructive". It could be worded better here, but it does seem like a real question for a specific task. (Consider how many "if statement not working" and "NPE" questions that aren't closed as they should be :-/) Commented Apr 14, 2012 at 9:22
  • @Iridio yes it is running in a webbrowser.i want to add a button to the browser when pressed it will send information to the c# program. Commented Apr 14, 2012 at 9:25
  • 1
    In your C# program implement a web service than when you click print in a html action contol send the request to the webservice whe request will be procesed in the server side and postback the result "price", use ajax/ Commented Apr 14, 2012 at 9:27

1 Answer 1

0

I'm not entirely clear how is your system set up so here is my assumption: You want to load some webpage (either locally or using URL) and communicate with that webpage using C# code. You might want to invoke a JavaScript function inside a webpage or you may want to listen to events in loaded webpage such as button click. All of these can be done by using Browser control. You can either create an instance of Browser control or use it in WinForms or WPF UI. I'm assuming your scenario is desktop app.

  1. If you want to invoke JavaScript function, use Browser.InvokeScript() method. There is a detailed article on how to do it.
  2. If you want to listen to events in browser control such as button click or link click then see this article for how-to.
  3. If you want to do more advanced customizations check out this C# wrapper.
Sign up to request clarification or add additional context in comments.

Comments

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.