muhammadantoniussony
May 22, 2020, 12:11 PM
Greeting, I need some help ...
This is my code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SetTahun.aspx.cs" Inherits="WebApplication1.Setup.SetTahun1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
function insertRecord(grid) {
var store = grid.store,
row = store.indexOf(store.insert(0, { })[0]);
Ext.defer(function () {
grid.editingPlugin.startEditByPosition({ row: row, column: 0 });
}, 100);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Classic">
</ext:ResourceManager>
<asp:ObjectDataSource
ID="TahunDS"
runat="server"
DataObjectTypeName="Belant.Asset.DAL.Tahun"
DeleteMethod="Delete"
InsertMethod="Save"
SelectMethod="GetList"
TypeName="Belant.Asset.BLL.ThnManager"
UpdateMethod="Edit">
</asp:ObjectDataSource>
<ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
<Items>
<ext:Panel runat="server" ID="PanelGrid" Region="North" Layout="FitLayout" Border="false">
<Items>
<ext:GridPanel ID="GridPanelTahun" runat="server" Scroll="Both" Border="false" >
<Store>
<ext:Store ID="StoreTahun"
runat="server"
DataSourceID="TahunDS"
OnRefreshData="StoreTahun_RefreshData"
OnBeforeStoreChanged="StoreTahun_BeforeChanged"
OnAfterRecordDeleted="StoreTahun_AfterRecordDeleted"
OnBeforeRecordInserted="StoreTahun_BeforeRecordInserted"
OnAfterRecordInserted="StoreTahun_AfterRecordInserted"
OnAfterRecordUpdated="StoreTahun_AfterRecordUpdated"
OnReadData="StoreTahun_ReadData"
RefreshAfterSaving="Always">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="IDTAHUN" Type="String" />
<ext:ModelField Name="TAHUN" Type="String" />
</Fields>
</ext:Model>
</Model>
<ServerProxy>
<ext:PageProxy>
<RequestConfig>
<EventMask ShowMask="true" CustomTarget="App.GridPanelTahun.getView().el" />
</RequestConfig>
</ext:PageProxy>
</ServerProxy>
</ext:Store>
</Store>
<ColumnModel ID="PrpColMdl" IDMode="Legacy" Enabled="true">
<Columns>
<ext:Column runat="server" ColumnID="IDTAHUN" DataIndex="IDTAHUN" Header="<b>ID Tahun</b>" Sortable="True" Flex="2" > <%--DataIndex="IDTAHUN"--%>
<Editor>
<ext:TextField ID="e_IDTahun" runat="server" AllowBlank="false" MaxLengthText="2" MaxLength="2" />
</Editor>
</ext:Column>
<ext:Column runat="server" ColumnID="TAHUN" DataIndex="TAHUN" Header="<b>Tahun</b>" Sortable="True" Flex="1"> <%--DataIndex="TAHUN"--%>
<Editor>
<ext:TextField ID="e_Tahun" runat="server" AllowBlank="false" />
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolBar ID="PagingToolBar1" runat="server" StoreID="StoreTahun" DisplayInfo="True" />
</BottomBar>
<SelectionModel>
<ext:RowSelectionModel runat="server" Mode="Multi">
<Listeners>
<Select Handler="#{btnDelete}.enable();" />
<Deselect Handler="if (!#{GridPanelTahun}.selModel.hasSelection()) {
#{btnDelete}.disable();
}" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
<Plugins>
<ext:CellEditing runat="server" />
</Plugins>
</ext:GridPanel>
</Items>
<Buttons>
<ext:Button ID="btnInsert" runat="server" Text="Tambah" Icon="Add"> <%--button --Insert-- --%>
<Listeners>
<%--<Click Handler="#{GridPanelTahun}.insertRecord(0, 0);
#{GridPanelTahun}.getView().focusRow(0);
#{GridPanelTahun}.startEditing(0, 0);" />--%>
<Click Handler="#{StoreTahun}.insert(0, {});#{GridPanelTahun}.editingPlugin.startEditByPos ition({row:0, column:0});" />
</Listeners>
</ext:Button>
<ext:Button ID="btnDelete" runat="server" Text="Hapus" Icon="Delete"> <%--button --Delete-- --%>
<Listeners>
<Click Handler="Ext.Msg.show({title:'Konfirmasi',
msg: 'Hapus data yang dipilih?',
buttons: Ext.Msg.YESNO,
fn: function(response) {
if ('yes' !== response) {
return;}
#{GridPanelTahun}.deleteSelected();
#{GridPanelTahun}.save();},
icon: Ext.MessageBox.QUESTION});" />
</Listeners>
</ext:Button>
<ext:Button ID="btnSave" runat="server" Text="Simpan" Icon="Disk"> <%--button --button Save-- --%>
<Listeners>
<Click Handler="#{StoreTahun}.sync();" /><%--<Click Handler="#{GridPanelTahun}.save();" />--%>
</Listeners>
</ext:Button>
<ext:Button ID="btnRefresh" runat="server" AutoPostBack="false" Text="Refresh" Icon="ArrowRefresh"> <%--button --Refresh-- --%>
<Listeners>
<Click Handler="#{StoreTahun}.reload();" /> <%--<Click Handler="#{GridPanelTahun}.reload();" />--%>
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
after I insert new data then click on 'Simpan' button always show this picture :
25341
and when I delete data .... they are delete from grid, but after I refresh it show up again and when I check on database ... they're not deleted
what's solution for that error .... thank's
This is my code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SetTahun.aspx.cs" Inherits="WebApplication1.Setup.SetTahun1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
function insertRecord(grid) {
var store = grid.store,
row = store.indexOf(store.insert(0, { })[0]);
Ext.defer(function () {
grid.editingPlugin.startEditByPosition({ row: row, column: 0 });
}, 100);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Classic">
</ext:ResourceManager>
<asp:ObjectDataSource
ID="TahunDS"
runat="server"
DataObjectTypeName="Belant.Asset.DAL.Tahun"
DeleteMethod="Delete"
InsertMethod="Save"
SelectMethod="GetList"
TypeName="Belant.Asset.BLL.ThnManager"
UpdateMethod="Edit">
</asp:ObjectDataSource>
<ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
<Items>
<ext:Panel runat="server" ID="PanelGrid" Region="North" Layout="FitLayout" Border="false">
<Items>
<ext:GridPanel ID="GridPanelTahun" runat="server" Scroll="Both" Border="false" >
<Store>
<ext:Store ID="StoreTahun"
runat="server"
DataSourceID="TahunDS"
OnRefreshData="StoreTahun_RefreshData"
OnBeforeStoreChanged="StoreTahun_BeforeChanged"
OnAfterRecordDeleted="StoreTahun_AfterRecordDeleted"
OnBeforeRecordInserted="StoreTahun_BeforeRecordInserted"
OnAfterRecordInserted="StoreTahun_AfterRecordInserted"
OnAfterRecordUpdated="StoreTahun_AfterRecordUpdated"
OnReadData="StoreTahun_ReadData"
RefreshAfterSaving="Always">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="IDTAHUN" Type="String" />
<ext:ModelField Name="TAHUN" Type="String" />
</Fields>
</ext:Model>
</Model>
<ServerProxy>
<ext:PageProxy>
<RequestConfig>
<EventMask ShowMask="true" CustomTarget="App.GridPanelTahun.getView().el" />
</RequestConfig>
</ext:PageProxy>
</ServerProxy>
</ext:Store>
</Store>
<ColumnModel ID="PrpColMdl" IDMode="Legacy" Enabled="true">
<Columns>
<ext:Column runat="server" ColumnID="IDTAHUN" DataIndex="IDTAHUN" Header="<b>ID Tahun</b>" Sortable="True" Flex="2" > <%--DataIndex="IDTAHUN"--%>
<Editor>
<ext:TextField ID="e_IDTahun" runat="server" AllowBlank="false" MaxLengthText="2" MaxLength="2" />
</Editor>
</ext:Column>
<ext:Column runat="server" ColumnID="TAHUN" DataIndex="TAHUN" Header="<b>Tahun</b>" Sortable="True" Flex="1"> <%--DataIndex="TAHUN"--%>
<Editor>
<ext:TextField ID="e_Tahun" runat="server" AllowBlank="false" />
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolBar ID="PagingToolBar1" runat="server" StoreID="StoreTahun" DisplayInfo="True" />
</BottomBar>
<SelectionModel>
<ext:RowSelectionModel runat="server" Mode="Multi">
<Listeners>
<Select Handler="#{btnDelete}.enable();" />
<Deselect Handler="if (!#{GridPanelTahun}.selModel.hasSelection()) {
#{btnDelete}.disable();
}" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
<Plugins>
<ext:CellEditing runat="server" />
</Plugins>
</ext:GridPanel>
</Items>
<Buttons>
<ext:Button ID="btnInsert" runat="server" Text="Tambah" Icon="Add"> <%--button --Insert-- --%>
<Listeners>
<%--<Click Handler="#{GridPanelTahun}.insertRecord(0, 0);
#{GridPanelTahun}.getView().focusRow(0);
#{GridPanelTahun}.startEditing(0, 0);" />--%>
<Click Handler="#{StoreTahun}.insert(0, {});#{GridPanelTahun}.editingPlugin.startEditByPos ition({row:0, column:0});" />
</Listeners>
</ext:Button>
<ext:Button ID="btnDelete" runat="server" Text="Hapus" Icon="Delete"> <%--button --Delete-- --%>
<Listeners>
<Click Handler="Ext.Msg.show({title:'Konfirmasi',
msg: 'Hapus data yang dipilih?',
buttons: Ext.Msg.YESNO,
fn: function(response) {
if ('yes' !== response) {
return;}
#{GridPanelTahun}.deleteSelected();
#{GridPanelTahun}.save();},
icon: Ext.MessageBox.QUESTION});" />
</Listeners>
</ext:Button>
<ext:Button ID="btnSave" runat="server" Text="Simpan" Icon="Disk"> <%--button --button Save-- --%>
<Listeners>
<Click Handler="#{StoreTahun}.sync();" /><%--<Click Handler="#{GridPanelTahun}.save();" />--%>
</Listeners>
</ext:Button>
<ext:Button ID="btnRefresh" runat="server" AutoPostBack="false" Text="Refresh" Icon="ArrowRefresh"> <%--button --Refresh-- --%>
<Listeners>
<Click Handler="#{StoreTahun}.reload();" /> <%--<Click Handler="#{GridPanelTahun}.reload();" />--%>
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
after I insert new data then click on 'Simpan' button always show this picture :
25341
and when I delete data .... they are delete from grid, but after I refresh it show up again and when I check on database ... they're not deleted
what's solution for that error .... thank's