Need help for newbie


#1

I am currently exploring GoDiagram as a possible solution for one of my projects and would like to find out whether the following is even possible.
a) Can I use the results returned from a database query to display nodes on a ASP.NET web page?
b)Am I forced to use GoDiagram using events? - The page in question has a lot of other functionality built into it and all I want to do is when a certain report type is set to “Chart”, it calls a “Load_GoChart” function which then creates all the nodes based on the db query.
c)Is there any functional example that I can see (besides the samples that comes with the eval version) that illustrate how to use a datareader’s resultset and draw nodes.
d) Is it possible to draw “n” number of nodes first and the loop thru each node trying to create links between various nodes.

ANY Help would be highly appreciated.
SM


#2

a) yes
b) no
c) no, but it’s fundamentally not any different than loading a file containing the data that directs how you create the nodes and links of your graph, and the samples do read/write files.
d) yes, that’s recommended
Basically you need to decide what appearance and behavior the nodes and links will have, customize the classes you want to use (which may include subclassing them), and then write the code to create instances of the nodes and links from your data.


#3

Walter, thanks for your prompt reply. I’m at a complete loss then as to what to do. I have the following working without any issues with a windows datagrid so I know my code works. However as soon as I start iterating thru the datareader and passing values to nodes, the godiagram never shows up on the screen.
Would you be kind enough again to please help - I can provide the source code if you want to see what I’m doing. Its probably something really silly but I’ve spent over 6 hours on this aspect of the project and am about ready to either evaluate some other product or just give up :(


#4

What do you mean by “the godiagram never shows up on the screen”?
If there’s only a placeholder for the image, but no image, then do you have cookies enabled, and have you included a copy of GoWebImage.aspx page in your virtual directory?
If there is an image, is it empty? Have you tried manually creating a node, positioning it so it should be visible, and adding it to the view’s Document? This is just to make sure your basic methodology of creating nodes and links works, independent of any database access.
Have you read through the GoWebIntro.doc, to get a better idea of how GoDiagram Web works? Remember that the GoView, its GoDocument, and all of its objects are serialized to Session state so that the separate image request can be satisfied. If you have added non-serializable state to any GoObject, that would cause a problem.


#5

I’ve read the documentation and done what needs to be done (ie. adding the blank aspx page, etc)…
With respects to adding non-serializable state - isn’t this something that would be done explicitly? I don’t believe I’ve done anything like that (yet)…
Here’s a brief breakdown of what my code looks like (hopefully you’ll see something that I’m missing)…
On the ASCX Page (this is a user control that gets loaded dynamically on to a page).
<asp:Panel ID=“pnlGoDiagram” Runat=“server”>



In the code behind page On the Page.IsPostback event I have a function call to
Load_Report()
In the Load_Report function I execute a query against the db and return a dataReader. I then iterate thru the datareader with the following (at this point I’m just trying to get the godiagram to load on the screen)…

If Not IsNothing(drSchedReport) Then
'Create a node object.
Dim cWindow As GoView = CType(pnlGoDiagram.FindControl(“chartWindow”), GoView)
If Not IsNothing(cWindow) Then
Dim doc As GoDocument = cWindow.Document
doc.Name = "Testing GO Charts"
chartWindow.Layers.Default.Identifier = "goView1 selection handles"
doc.Layers.Default.Identifier = "Default Layer of Document"
doc.LinksLayer = doc.Layers.CreateNewLayerBefore(doc.DefaultLayer)Doc.LinksLayer.Identifier = "layer of links in document"
Dim initialPoint As Integer = 10
While drSchedReport.Read
'Ok now start drawing the nodes for this report on the screen.
Dim tn As GoTextNode = New GoTextNode
tn.Text = drSchedReport(“IN_CONDITION”).ToString()
tn.Position = New System.Drawing.PointF(initialPoint, 50)cWindow.Document.Add(tn)
initialPoint += 10
End While
drSchedReport.Close()
drSchedReport.Dispose()
End If
End If
When I load the page, all I see on it is the following













I had omitted the table tags inside which the GoDiagram was placed (at the top) but I don’t think this should make any difference. Am I missing something here?
I am using the evaluation version on a Windows 2003 Enterprise Server with ASP.NET 1.1
As before, any help would be gladly appreciated.
SM.

#6

First, a minor point: you ought to be able to refer to the GoView by using the “chartWindow” identifier, rather than having to dynamically call FindControl.
Second, Page doesn’t have an IsPostBack event–that’s a property. Perhaps you meant the Page.Load event.
Third, you probably should be doing the initialization of the document in a GoView.SessionStarted event handler that is established in the Page.Load event handler:
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler MyView.SessionStarted, New EventHandler(AddressOf InitializeDocument)
End Sub
Private Sub InitializeDocument(ByVal sender As Object, ByVal e As EventArgs)
. . . do your Load_Report stuff here
End Sub
Implementing the GoView.SessionStarted event handler to do your initialization will help handle the case when the session times out. But perhaps you have an alternative way of handling that case…
Your loop to create GoTextNodes looks reasonable, although I think you’ll need a larger spacing constant than 10. And I assume you haven’t gotten around to adding links yet. You might want to consider using GoLayout to position all the nodes once you have created the graph without specifying any positions explicitly.
You don’t need to assign the document Name and layer Identifier properties, in all likelihood. But perhaps you anticipate some use for them later…
I don’t know how you got an HTML page that only has a

element in it, and no referring to “GoWebImage.aspx”. That’s not what a GoView renders. Take a look at one of the sample applications to see what it renders (for the browser you are viewing it with).

#7

Walter,
Thanks for your help - that certainly got the chart loading as soon as I added it to the Page_Load event. So as far as that goes, I guess I was doing something wrong
However based on my page design, I had to do a little redesign because my user control is actually a page that displays more than just GoDiagrams. Actually its a page that displays other types of reports too. The way I had the page setup, if it determines that the user wants a ChartControl then he/she is presented with an option for the filters for a given db query. THe user then enters values for the filters and then I check on the Page.IsPostback to determine what to load.
Using your example from above, the chart was showing up by default (which was not desirable). So what I did was move it to another user control (GoDiagramChartControl.ascx) and then moved all my logic to load the chart control from there.
In the original page, I now determine whether the user wants to load the chart control, create an instance of the GoDiagramChartControl.ascx page and then give it the various parameters to load information from the db. Finally I add the newly created control into the Panel (that I had described in my previous posts).
Right off the bat, I always get a NullReference Error as soon as do
pnlGoDiagram.Controls.Add(userControl_GoDiagramChartControl) . So I messed around a little bit with it to try and see whether I was inheriting from the right classes or not. I had it inheriting from the generic System.Web.UI.UserControl and kept getting this error. When I changed the control to inherit from the Northwoods.GoWeb.GoView control, the page is loading fine but never fires the function defined in the Event Handler.
I think I’m very close and please forgive the apparent stupidity of some of these questions - I am still trying to learn how GoDiagram works and am obviously missing the apparent.
I can also be reached via email (if you feel that this forum is not appropriate for this thread - smeh_AT_HOTMAIL_COM)
Thanks again for your help so far.
SM


#8

Well, I must say that I find the ASP.NET control lifecycle (combined with the various "DOM"s) to be difficult to master. And there are all the new features coming in Whidbey…
When you are inheriting from GoView, which event are you not getting? If you aren’t getting the SessionStarted event, that means either the event handler hasn’t been registered or that the control isn’t being Loaded properly.
Once you have decided to have your own subclass of GoView, you don’t need to define your own separate event handlers for GoView events, but you should instead override the corresponding On… methods. That will help simplify things, because there might be some confusion as to when and how those view event handlers are being defined.
But it still isn’t apparent to me what’s going wrong in your web app.