Calling back into WiseJ from HTML/JS

0
0

I’m looking for an example or a pointer to the right place in the documentation.

Here’s the scenario – I’m porting an application from VWG to WiseJ.  I have a few pages where the WiseJ page hosts an HtmlPanel and injects HTML into that panel at runtime.  I need to connect events on buttons or links in that HTML to handlers in WiseJ. In the VWG application, the onclick events were invoking something called SendMessage, if that helps.

I’m basically a backend developer and know only enough JS/HTML to get into trouble, so a nice clear example is what I need.

  • You must to post comments
0
0

Hi Carl,

For starters, the HtmlPanel has an ElementClick event that fires when the user clicks an HTML element.

The ElementClickArgs has two properties, the Element and Role properties.

You can go here for more information:

Also, I have attached a small sample that demonstrates all of the above.

HTH,
Alaa

  • Carl Daniel
    I’ll take a look. It’s possible that the HTML will have dozens of elements each of which needs to bind to a different action based on content that’s in the generated HTML – i.e. I don’t know in advance which events I need to hook up to which elements, but I’ll see what that facility provides & maybe I can make it work.
  • Carl Daniel
    I think I can make that work. It’ll require re-designing the HTML that’s inside the panel (which, fortunately, I can do) or parsing HTML to fish out what would have been parameters to the click event handler, but I think it’ll work. Thanks for the pointer.
  • Carl Daniel
    This is not going to work, at least not everywhere. I’ve got some HTML to host that contains embedded JavaScript – I need to raise an event from in that JS code that can be handled by C# code on the server side. The VWG mechanism used to do this was VWG.Events.CreateEvent, which allows one to raise an event on the server side for any element in the UI. On the server side, Control.FireEvent was overridden to handle these events. The mechanism provided by HtmlPanel seems insufficient to handle this.
  • Luca (ITG)
    widget.fireWidgetEvent(“eventName”, data);
  • Luca (ITG)
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.