Skip to main content
<K2:K2DataGrid id="cr_apps" runat="server" Width="240px" Visible="False" 
AutoGenerateColumns="False" onitemcommand="OfficeDelete" CellPadding="2">
<ItemStyle Wrap="False" HorizontalAlign="Left" ForeColor="Black" BackColor="WhiteSmoke">
</ItemStyle>
<Columns>
<asp:BoundColumn Visible="False" DataField="ID"></asp:BoundColumn>
<asp:BoundColumn DataField="Description"></asp:BoundColumn>
<asp:ButtonColumn DataTextField="Remove" CommandName="Delete">
<ItemStyle ForeColor="#3300FF" Width="20px"></ItemStyle>
</asp:ButtonColumn>
</Columns>
</K2:K2DataGrid>


This sample of code when viewed within the html editor comes up with errors. What is the correct k2 tags for BoundColumns, ButtonColumns, ItemSyle and Columns???
A K2 Datagrid is designed sot that it will automatically create the columns for you when you set the DataField and DataXPath properties to point to an XML structure in your process.

For example I have the following XML structure in my K2 process:

Root
|->Items
----|->Item
--------|->Name
--------|->Description

When I set DataField = ProcXML:testxml and DataXPath to Root/items/item I get the following html generated based upon the xml:

K2:K2DataGrid id="K2DataGrid1" style="Z-INDEX: 103; LEFT: 48px; POSITION: absolute; TOP: 24px" runat="server" DataXPath="/Root/items/item" DataField="ProcXML: testxml" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="name" HeaderText="name"><HeaderStyle Width="200px"></HeaderStyle><ItemStyle Width="200px"></ItemStyle></asp:BoundColumn>
<asp:BoundColumn DataField="description" HeaderText="description"><HeaderStyle Width="200px"></HeaderStyle><ItemStyle Width="200px"></ItemStyle></asp:BoundColumn>
</Columns>
</K2:K2DataGrid>

If you want to define your own columns that are not tied directly to a K2 xml field you might want to use a standard datagrid.

I hope this helps.

- Eric

Reply