onclick shape alert using webform


https://www.nevron.com/Forum/Topic8681.aspx
Print Topic | Close Window

By Cristianf - 10 Years Ago
Hi all,
as I mentioned in my last topic I'm new to Nevron and I'm trying to understand its potential into my future software.

What I'm trying to achieve is to display a popup when clicking on a shape in the NDrawingView component.
For the click event I used a nice example in the knowledge base like reference, link:
http://support.nevron.com/KB/a209/implement-click-double-click-events-the-diagram-aspnet.aspx

In the AsyncClick event I tried to call a javascript function to display a simple alert, afterwards I will add a nice popup window using jquery so I would like to achieve something like this: http://jqueryui.com/dialog/#animated

So my source code for the simple javascript alert is:


protected void Page_Load(object sender, EventArgs e)
{
// create a new persistency manager
NPersistencyManager persistencyManager = new NPersistencyManager();
 // load a drawing from a file
NDrawingDocument drawing = persistencyManager.LoadDrawingFromFile("C:\\example.ndx");
 // display the document into the view
NDrawingView1.Document = drawing;
}

protected void NDrawingView1_AsyncClick(object sender, EventArgs e)
{
  ScriptManager.RegisterStartupScript(this, typeof(string), "open", "test();", true);
}

protected void NDrawingView1_QueryAjaxTools(object sender, EventArgs e)
 {
   NDrawingView1.AjaxTools.Add(new NAjaxMouseClickCallbackTool(true));
 }


And this is my page source:


<%@ Control Language="C#" .... %>
<%@ Register assembly="Nevron.Diagram.WebForm, .....%>

    <ndwc:NDrawingView ID="NDrawingView1" runat="server" Height="273px" OnAsyncClick="NDrawingView1_AsyncClick" Width="466px" AjaxEnabled="True" AsyncCallbackTimeout="10000" OnQueryAjaxTools="NDrawingView1_QueryAjaxTools" AjaxScriptBuild="Debug">
    </ndwc:NDrawingView>
<br />
<p>
<script>
    function test() {
        alert("ok");
    }
</script>

Obviously I added the other code in the webconfig and the dll references, I will not copy all code here for space reasons...


The async click event works great if I riproduce the example from the knowledge base (http://support.nevron.com/KB/a209/implement-click-double-click-events-the-diagram-aspnet.aspx)
but it doesn't when trying to call the javascript function... I used the debugger but it doesn't trigger errors, any help?
By Cristianf - 10 Years Ago
I didn't found a solution yet Sad
 But I've seen an example of mouse down event with javascript alert using the ThinWeb component, link: http://examplesaspnetdiagram.nevron.com/Frames/NExampleFrame.aspx?ExampleUrl=Examples/ThinWeb/NClientSideEventsToolUC.ascx

I tried to do this with
NDrawingView component but it tells me that the class NInteractivityStyle isn't available... any suggestions?

Thank you
By Nevron Support - 10 Years Ago
Hi,

We recommend you migrate your project to the thin web diagram component as it is newer and improved version of the old ASP .NET diagramming component. It offers many new features as well as improved performance and stability.

Regarding your case, you can also take a look at the Business Company example. It uses custom commands to send data from the server to the client. This data is then processed via JavaScript in the $(document).ready() function of the client's web page. You can use it to show a popup based on the data sent by the server.
By Cristianf - 10 Years Ago
Beautiful! It worked with thin web component!

Thank you very much.