-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDefault.aspx
80 lines (75 loc) · 4.25 KB
/
Default.aspx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="DevExpress.Web.v14.1, Version=14.1.15.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript">
var isNewClicked = false;
function hlNew_Click(s, e) {
if (gridView.batchEditApi.HasChanges()) {
if (confirm("All changes will be saved automatically. Do you want to continue?"))
gridView.UpdateEdit();
isNewClicked = true;
}
else {
hf.Set("isNewClicked", true);
cp.PerformCallback();
}
}
function OnEndCallback(s, e) {
if (isNewClicked == true) {
isNewClicked = false;
hf.Set("isNewClicked", true);
}
else hf.Set("isNewClicked", false);
cp.PerformCallback();
}
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<dx:ASPxHiddenField ID="hf" runat="server" ClientInstanceName="hf"></dx:ASPxHiddenField>
<dx:ASPxCallbackPanel ID="ASPxCallbackPanel1" runat="server" ClientInstanceName="cp" OnCallback="ASPxCallbackPanel1_Callback">
<PanelCollection>
<dx:PanelContent runat="server">
<dx:ASPxGridView ID="gridView" runat="server" AutoGenerateColumns="False" ClientInstanceName="gridView" DataSourceID="ads" KeyFieldName="CategoryID" >
<ClientSideEvents EndCallback="OnEndCallback" />
<Columns>
<dx:GridViewCommandColumn ShowInCustomizationForm="True" ShowNewButtonInHeader="True" VisibleIndex="0">
<HeaderTemplate>
<dx:ASPxHyperLink ID="hlNew" runat="server" Text="New">
<ClientSideEvents Click="hlNew_Click" />
</dx:ASPxHyperLink>
</HeaderTemplate>
</dx:GridViewCommandColumn>
<dx:GridViewDataTextColumn FieldName="CategoryID" ReadOnly="True" ShowInCustomizationForm="True" VisibleIndex="1">
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="CategoryName" ShowInCustomizationForm="True" VisibleIndex="2">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Description" ShowInCustomizationForm="True" VisibleIndex="3">
</dx:GridViewDataTextColumn>
</Columns>
<SettingsEditing Mode="Batch"></SettingsEditing>
</dx:ASPxGridView>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxCallbackPanel>
<asp:AccessDataSource ID="ads" runat="server" DataFile="~/App_Data/nwind.mdb" SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]" DeleteCommand="DELETE FROM [Categories] WHERE [CategoryID] = ?" InsertCommand="INSERT INTO [Categories] ([CategoryName], [Description]) VALUES (?, ?)" UpdateCommand="UPDATE [Categories] SET [CategoryName] = ?, [Description] = ? WHERE [CategoryID] = ?">
<DeleteParameters>
<asp:Parameter Name="CategoryID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="CategoryName" Type="String" />
<asp:Parameter Name="Description" Type="String" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="CategoryName" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="CategoryID" Type="Int32" />
</UpdateParameters>
</asp:AccessDataSource>
</form>
</body>
</html>