K2Datagrid not displaying run-time

  • 13 July 2004
  • 8 replies
  • 0 views

Badge
Symptoms:
K2Datagrid displays design-time, but not run-time.
No error messages are displayed design-time or run-time.

Version:
K2.net 2003 Hotfix2

Resolution:
Delete the XML Datafield from the process in K2 Studio. Re-create the XML Datafield and bind it to the K2Datagrid. The datagrid should work now!

8 replies

Badge +1
I am experiencing a similar issue with K2 2003 SP1. I am trying to display an XML data structure with repeating nodes in the K2 DataGrid. The XML structure is similar to the following:

<order>
...<name />
...<orgUnit />
...<items>
......<item>
........<desc />
........<cost />
........<qty />
......</item>
......<item>
........<desc />
........<cost />
........<qty />
......</item>
...</items>
</order>

The grid is displaying at design time and is picking up the correct columns. However at run time the grid is not displayed at all and I receive no error messages. I have tried deleting the XML Schema in K2 Studio and recreating as well as deleting the datagrid and recreating it. Neither option has resolved the problem. My current workaround involves loading the xml node with the repeating items into a text field, reading that into a dataset and then binding it to a regular datagrid. This is quite a bit more work, though, and I would prefer to avoid this if possible. Any suggestions or pointers here would be greatly appreciated.

Also, I originally created my schema using XMLSpy and then imported into K2 Studio -- are there any restrictions or "gotchas" for doing this? Will any of the extra comments/annotations that XMLSpy produces cause problems with K2? I have since recreated the schema manually in K2, but this did not resolve my datagrid issue. I was more curious about this going forward.

Thanks in advance,
-Scott
Badge +1
I'm also experieincing problems using the K2DataGrid control. Like ScottA I'd like to bind the DataGrid to XML in a similar fashion - the list of items example is similar enough, although I want to allow the user to add and delete rows.

However, although I can display the K2DataGrid with the default settings, changing the column types to "templates" for formatting purposes breaks the add and edit functionality:

1) when the data is changed in an editable row, the "update" action does not update the data;

2) the "add" button/link does not add any new rows to the grid.

I had thought about ScottA's work-round of binding the XML to a textbox and then loading the XML into a standard datagrid:
My current workaround involves loading the xml node with the repeating items into a text field, reading that into a dataset and then binding it to a regular datagrid.
but I am not sure how to extract the data from the updated grid to re-populate the XML in the text field. I would greatly appreciate any tips and advice.

Many thanks,
Pete
Badge +1
Hi Peter,
My workflow process has couple steps in it -- one allows the user to create the order (adding and deleting rows) and a second step where they can modify information in the existing rows but they can no longer add or remove them.

For the first step, I am using a dataset behind the scenes to maintain the data. As they add and remove rows I update the underlying dataset and (re)save it to my session var. Then when the page reloads I get the dataset back out of my session and rebind it to the grid. While all this is going on I also use the GetXML method on the dataset to extract the "raw" xml string and stuff that into a hidden K2 text field that is bound to the correct node in my K2 schema. This way whenever the user fully submits the form the current xml data will be persisted to K2 as well.

When the flow hits the second step I have another hidden text box bound to that same node. In the load event for the textbox, I read the XML into another dataset and bind to my grid for display purposes. When the user clicks the update button (click event) I get the values from the controls and modify the corresponding row in the dataset. I then use the GetXML method again to pull out the updated version and stuff that back into the textbox. The K2 server logic seems to fire after the update button's click event so my changes are persisted to the workflow. When the page reloads it has the new xml to create the updated dataset and the process starts over.

Not overly pretty, but seems to be working at this point. Hopefully this will give you some additional ideas.

-Scott
Badge +1
Hi Scott,

Thanks for that breakdown of your work-round. It seems that that's the sort of thing I'll need to do to use the DataGrid. I'll just need to learn how to copy the data from the Grid back to the Dataset to extract the XML. Your right though - it isn't very pretty.

Thanks,
Pete.
Badge +1
I found a semi simple workaround to the disappearing k2datagrid. I added a normal asp.net datagrid to the page and just bound the datasource to k2datagrid.thisdataset and the datamember to k2datagrid.thisdatamember and that seemed to work pretty well.
You just have to capture the add/update/delete commands and apply them to the k2datagrid rather than the asp.net datagrid. A little extra work, but not a big deal.
Badge +9
What version of K2.net 2003 are you running?
Badge +1
Were you asking me renier? If so K2 .net 2003 SP2a
Badge +9
It is always good to make sure we test against the same version of the product, and also to confirm against our systems the various changes implemented in versions of K2.net.

Reply