Problem with Ajax Async Click and Redirect


Author
Message
Anna Lear
Anna Lear
Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)
Group: Forum Members
Posts: 12, Visits: 1
I'm trying to set up an auto-redirect when the user clicks on a diagram element. It's mostly working fine, except for a couple connector elements. When I click on those, I end up redirected to a wrong page.

I have the drawing view set up this way:
<ndwc:NDrawingView ID="NDrawingView1" runat="server" Height="529px" Width="738px" BorderStyle="None" EnableTheming="false" AjaxEnabled="True" OnQueryAjaxTools="NDrawingView1_QueryAjaxTools"></ndwc:NDrawingView>

Then I have a method on the page that displays the diagram that sets the interactivity style on the shapes:
foreach (NShape node in NDrawingView1.Document.ActiveLayer.Children(new NInstanceOfTypeFilter(typeof(NShape))))
{
var interactivityStyle = new NInteractivityStyle {
GenerateImageMapObject = true,
UrlLink =
new NUrlLinkAttribute(@"/OtherPage.aspx?SelectedElement=" +
Server.HtmlEncode(node.Name), false)
};
node.Style.InteractivityStyle = interactivityStyle;
}

And finally, the contents of the QueryAjaxTools handler:
protected void NDrawingView1_QueryAjaxTools(object sender, EventArgs e)
{
NDrawingView1.AjaxTools.Add(new NAjaxMouseClickCallbackTool(true, true));
NDrawingView1.AjaxTools.Add(new NAjaxRedirectTool(true));
}

I have verified that the diagram itself is valid and the element clicks has the correct InteractivityStyle set, with the correct URL.

However, let's say the problem element's name is A. Some other element on the diagram is called B. Where I expect to end up at OtherPage.aspx?SelectedElement=A, I am instead redirected to OtherPage.aspx?SelectedElement=B.

Are there any particular spots I should check to try and figure out what's going on? The diagram? My code?

Thanks.
Reply
Anna Lear
Anna Lear
Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)
Group: Forum Members
Posts: 12, Visits: 1

Makes sense. Unfortunately, I'm not sure this applies to my situation, since none of the shapes in my diagram overlap. It's just a few rectangles and connectors between them.

I'm loading a previously created diagram from file instead of generating it programmatically, so I don't have much control over the shape order or positioning. All I do is loop through the shapes to assign proper InteractivityStyles as described in my original post. Then when I click on one of my connectors, for some reason a rectangle in a different part of the diagram is chosen as the shape I clicked on.

On the same diagram, if I don't use the AjaxRedirectTool but instead handle the AsyncClick event and do my own hit testing, the correct shapes are returned for all clicks:

protected void NDrawingView1_AsyncClick(object _sender, EventArgs _e)
{ 
var args = _e as NCallbackMouseEventArgs;
NNodeList nodes = NDrawingView1.HitTest(args);
}

I'm not sure what the difference is between that code and the hit testing that AjaxRedirectTool provides.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search