Error when add row by client side (SelfReferencing Mode)

2 replies. Last post: June 1, 2015 9:15 AM by Minh Le
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Minh LeMember
Hi Intersolf

I am using webgrid 6 and i interest with webgrid 9.

I am trying with intersoft studio 2014 r2 and i have some problem.

I cannot add new row when AllowBatchUpdate = "true" and using SelfReferencing mode.

This is my code

<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>
<table>
<tr>
<td>
<ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="450px" UseDefaultStyle="True" Width="100%" OnAddRow="WebGrid1_AddRow"
OnInitializeDataSource="WebGrid1_InitializeDataSource" OnInitializeRow="WebGrid1_InitializeRow"
OnInitializeSelfReferenceDataSource="WebGrid1_InitializeSelfReferenceDataSource">
<LayoutSettings AllowEdit="Yes" InProgressUIBehavior="ChangeCursorToHourGlass" AllowBatchUpdate="true">
<ClientSideEvents />
</LayoutSettings>
</ISWebGrid:WebGrid>
</td>
</tr>
<tr>
<td>
<input type="button" id="AddButton" value="Add" class="text" style="width: 75px" onclick="DoAdd()" />
</td>
</tr>
</table>
<script>
function DoAdd()
{
var grid = ISGetObject("WebGrid1");
var newRow = grid.RootTable.NewRow(); // create new row object
var cells = newRow.GetCells(); // get WebGridCell collection

cells.GetNamedItem("ID").SetText("E6", true);
cells.GetNamedItem("Name").SetText("Emp 6", true);
cells.GetNamedItem("Phone").SetText("12345", true);
cells.GetNamedItem("ParentID").SetText("M1", true);
cells.GetNamedItem("HasChild").SetText("0", true);
newRow.Update();
grid.AcceptAllChanges();
}
</script>

Please help me!

Thanks

1 attachment
All times are GMT -5. The time now is 4:32 PM.
Previous Next