-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDefault.aspx.vb
More file actions
87 lines (78 loc) · 4.39 KB
/
Default.aspx.vb
File metadata and controls
87 lines (78 loc) · 4.39 KB
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
81
82
83
84
85
86
87
Imports System
Imports DevExpress.Web
Imports System.Collections.Specialized
Namespace MultiCombo
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Cat1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim combo1 As ASPxComboBox = DirectCast(sender, ASPxComboBox)
Dim oldCat1 As Object = Session("Cat1ID")
If oldCat1 IsNot Nothing AndAlso oldCat1.Equals(combo1.Value) Then
Return
End If
Session("Cat1ID") = combo1.Value
Dim combo2 As ASPxComboBox = (CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category2ID"), GridViewDataComboBoxColumn), "Cat2"), ASPxComboBox))
combo2.Value = Nothing
Cat2_SelectedIndexChanged(combo2, EventArgs.Empty)
End Sub
Protected Sub Cat2_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim combo2 As ASPxComboBox = DirectCast(sender, ASPxComboBox)
Dim oldCat2 As Object = Session("Cat2ID")
If oldCat2 IsNot Nothing AndAlso oldCat2.Equals(combo2.Value) Then
Return
End If
Session("Cat2ID") = combo2.Value
Dim combo3 As ASPxComboBox = (CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category3ID"), GridViewDataComboBoxColumn), "Cat3"), ASPxComboBox))
combo3.Value = Nothing
Cat3_SelectedIndexChanged(combo3, EventArgs.Empty)
End Sub
Protected Sub Cat3_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim combo3 As ASPxComboBox = DirectCast(sender, ASPxComboBox)
Dim oldCat3 As Object = Session("Cat3ID")
If oldCat3 IsNot Nothing AndAlso oldCat3.Equals(combo3.Value) Then
Return
End If
Session("Cat3ID") = combo3.Value
Dim combo4 As ASPxComboBox = (CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category4ID"), GridViewDataComboBoxColumn), "Cat4"), ASPxComboBox))
combo4.Value = Nothing
End Sub
Protected Sub grid_HtmlRowCreated(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridViewTableRowEventArgs)
If (e.RowType = GridViewRowType.InlineEdit) Then
Dim combo2 As ASPxComboBox = (CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category2ID"), GridViewDataComboBoxColumn), "Cat2"), ASPxComboBox))
If Request.Params(combo2.UniqueID) IsNot Nothing Then
Return
End If
If Not grid.IsNewRowEditing Then
Dim vals() As Object = CType(grid.GetRowValues(grid.EditingRowVisibleIndex, New String() { "Category2ID", "Category3ID", "Category4ID" }), Object())
Dim combo4 As ASPxComboBox = (CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category4ID"), GridViewDataComboBoxColumn), "Cat4"), ASPxComboBox))
Dim combo3 As ASPxComboBox = (CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category3ID"), GridViewDataComboBoxColumn), "Cat3"), ASPxComboBox))
combo2.Value = vals(0)
combo3.Value = vals(1)
combo4.Value = vals(2)
End If
End If
End Sub
Protected Sub grid_StartRowEditing(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxStartRowEditingEventArgs)
Dim vals() As Object = CType(grid.GetRowValuesByKeyValue(e.EditingKeyValue, New String() { "Category1ID", "Category2ID", "Category3ID" }), Object())
Session("Cat1ID") = vals(0)
Session("Cat2ID") = vals(1)
Session("Cat3ID") = vals(2)
End Sub
Protected Sub grid_RowUpdating(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxDataUpdatingEventArgs)
SaveOrInsertData(e.NewValues)
End Sub
Private Sub SaveOrInsertData(ByVal NewValues As OrderedDictionary)
Dim cat1 As Object = CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category1ID"), GridViewDataComboBoxColumn), "Cat1"), ASPxComboBox).Value
NewValues("Category1ID") = cat1
Dim cat2 As Object = CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category2ID"), GridViewDataComboBoxColumn), "Cat2"), ASPxComboBox).Value
NewValues("Category2ID") = cat2
Dim cat3 As Object = CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category3ID"), GridViewDataComboBoxColumn), "Cat3"), ASPxComboBox).Value
NewValues("Category3ID") = cat3
Dim cat4 As Object = CType(grid.FindEditRowCellTemplateControl(TryCast(grid.Columns("Category4ID"), GridViewDataComboBoxColumn), "Cat4"), ASPxComboBox).Value
NewValues("Category4ID") = cat4
End Sub
Protected Sub grid_RowInserting(ByVal sender As Object, ByVal e As DevExpress.Web.Data.ASPxDataInsertingEventArgs)
SaveOrInsertData(e.NewValues)
End Sub
End Class
End Namespace