i want to display some data in a grid but this is the error i get.
withEvents variable 'DataGrid1' implicitly defines '_DataGrid1', which conflicts with a member of the same name in class 'mastersearch'.
i tried renaming the variables but that does not help because it EITHER doesnt bind the data at all OR does bind it but doesnt trigger the page change event
this is the code if it helps
thanks in advance
Public Class mastersearch
Inherits Page
' Methods
Public Sub New()
AddHandler MyBase.Init, New EventHandler(Ad dressOf Me.Page_Init)
AddHandler MyBase.Load, New EventHandler(Ad dressOf Me.Page_Load)
Me.qry = ""
End Sub
Private Sub DataGrid1_PageI ndexChanged(ByV al source As Object, ByVal e As DataGridPageCha ngedEventArgs)
Me.DataGrid1.Cu rrentPageIndex = e.NewPageIndex
Me.doSearch()
End Sub
Public Sub doSearch()
Try
Me.DataView1.Ro wFilter = Me.Session.Item ("qry").ToStrin g
Me.OleDbDataAda pter1.Fill(Me.D ataSet21.Tables .Item(0))
Me.Response.Wri te(("<b>" & StringType.From Integer(Me.Data View1.Count) & " records found.</b><p>"))
Me.DataGrid1.Da taBind()
Catch exception2 As Exception
ProjectData.Set ProjectError(ex ception2)
Dim exception1 As Exception = exception2
Me.Response.Wri te(("Could not perform search, please try again" & ChrW(13) & "<!-- " & exception1.Mess age & "-->"))
ProjectData.Cle arProjectError( )
End Try
End Sub
<DebuggerStepTh rough()> _
Private Sub InitializeCompo nent()
.....parameters and declarations not shown here ......
Private Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
Me.InitializeCo mponent()
End Sub
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not Me.IsPostBack Then
Dim text1 As String = Me.Request.Item ("_mode")
If (Not Me.Request.Item ("_dir") Is Nothing) Then
Me.qry = ("surname like '" & Me.Request.Item ("_dir") & "%'")
ElseIf ((Not text1 Is Nothing) AndAlso (StringType.Str Cmp(text1, "adv", False) = 0)) Then
Dim num2 As Integer = (Me.Request.For m.Count - 1)
Dim num1 As Integer = 0
Do While (num1 <= num2)
If Not Me.Request.Form .Keys.Item(num1 ).StartsWith("_ ") Then
If (StringType.Str Cmp(Me.qry, "", False) <> 0) Then
Me.qry = (Me.qry & " AND ")
End If
Dim textArray1 As String() = New String() {Me.qry, "[", Me.Request.Form .Keys.Item(num1 ), "] like '%", Me.Request.Form .Item(num1), "%' "}
Me.qry = String.Concat(t extArray1)
End If
num1 += 1
Loop
End If
Me.Session.Item ("qry") = Me.qry
Me.doSearch()
End If
End Sub
' Properties
Protected Overridable Property DataGrid1() As DataGrid
Get
Return Me._DataGrid1
End Get
Set(ByVal WithEventsValue As DataGrid)
If (Not Me._DataGrid1 Is Nothing) Then
RemoveHandler Me._DataGrid1.P ageIndexChanged , New DataGridPageCha ngedEventHandle r(AddressOf Me.DataGrid1_Pa geIndexChanged)
End If
Me._DataGrid1 = WithEventsValue
If (Not Me._DataGrid1 Is Nothing) Then
AddHandler Me._DataGrid1.P ageIndexChanged , New DataGridPageCha ngedEventHandle r(AddressOf Me.DataGrid1_Pa geIndexChanged)
End If
End Set
End Property
Protected Overridable Property DataSet21() As DataSet2
Get
Return Me._DataSet21
End Get
Set(ByVal WithEventsValue As DataSet2)
If (Not Me._DataSet21 Is Nothing) Then
End If
Me._DataSet21 = WithEventsValue
If (Not Me._DataSet21 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property DataView1() As DataView
Get
Return Me._DataView1
End Get
Set(ByVal WithEventsValue As DataView)
If (Not Me._DataView1 Is Nothing) Then
End If
Me._DataView1 = WithEventsValue
If (Not Me._DataView1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbConnection 1() As OleDbConnection
Get
Return Me._OleDbConnec tion1
End Get
Set(ByVal WithEventsValue As OleDbConnection )
If (Not Me._OleDbConnec tion1 Is Nothing) Then
End If
Me._OleDbConnec tion1 = WithEventsValue
If (Not Me._OleDbConnec tion1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbDataAdapte r1() As OleDbDataAdapte r
Get
Return Me._OleDbDataAd apter1
End Get
Set(ByVal WithEventsValue As OleDbDataAdapte r)
If (Not Me._OleDbDataAd apter1 Is Nothing) Then
End If
Me._OleDbDataAd apter1 = WithEventsValue
If (Not Me._OleDbDataAd apter1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbDeleteComm and1() As OleDbCommand
Get
Return Me._OleDbDelete Command1
End Get
Set(ByVal WithEventsValue As OleDbCommand)
If (Not Me._OleDbDelete Command1 Is Nothing) Then
End If
Me._OleDbDelete Command1 = WithEventsValue
If (Not Me._OleDbDelete Command1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbInsertComm and1() As OleDbCommand
Get
Return Me._OleDbInsert Command1
End Get
Set(ByVal WithEventsValue As OleDbCommand)
If (Not Me._OleDbInsert Command1 Is Nothing) Then
End If
Me._OleDbInsert Command1 = WithEventsValue
If (Not Me._OleDbInsert Command1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbSelectComm and1() As OleDbCommand
Get
Return Me._OleDbSelect Command1
End Get
Set(ByVal WithEventsValue As OleDbCommand)
If (Not Me._OleDbSelect Command1 Is Nothing) Then
End If
Me._OleDbSelect Command1 = WithEventsValue
If (Not Me._OleDbSelect Command1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbUpdateComm and1() As OleDbCommand
Get
Return Me._OleDbUpdate Command1
End Get
Set(ByVal WithEventsValue As OleDbCommand)
If (Not Me._OleDbUpdate Command1 Is Nothing) Then
End If
Me._OleDbUpdate Command1 = WithEventsValue
If (Not Me._OleDbUpdate Command1 Is Nothing) Then
End If
End Set
End Property
' Fields
<AccessedThroug hProperty("Data Grid1")> _
Public _DataGrid1 As DataGrid
<AccessedThroug hProperty("Data Set21")> _
Private _DataSet21 As DataSet2
<AccessedThroug hProperty("Data View1")> _
Private _DataView1 As DataView
<AccessedThroug hProperty("OleD bConnection1")> _
Private _OleDbConnectio n1 As OleDbConnection
<AccessedThroug hProperty("OleD bDataAdapter1") > _
Private _OleDbDataAdapt er1 As OleDbDataAdapte r
<AccessedThroug hProperty("OleD bDeleteCommand1 ")> _
Private _OleDbDeleteCom mand1 As OleDbCommand
<AccessedThroug hProperty("OleD bInsertCommand1 ")> _
Private _OleDbInsertCom mand1 As OleDbCommand
<AccessedThroug hProperty("OleD bSelectCommand1 ")> _
Private _OleDbSelectCom mand1 As OleDbCommand
<AccessedThroug hProperty("OleD bUpdateCommand1 ")> _
Private _OleDbUpdateCom mand1 As OleDbCommand
Private qry As String
End Class
withEvents variable 'DataGrid1' implicitly defines '_DataGrid1', which conflicts with a member of the same name in class 'mastersearch'.
i tried renaming the variables but that does not help because it EITHER doesnt bind the data at all OR does bind it but doesnt trigger the page change event
this is the code if it helps
thanks in advance
Public Class mastersearch
Inherits Page
' Methods
Public Sub New()
AddHandler MyBase.Init, New EventHandler(Ad dressOf Me.Page_Init)
AddHandler MyBase.Load, New EventHandler(Ad dressOf Me.Page_Load)
Me.qry = ""
End Sub
Private Sub DataGrid1_PageI ndexChanged(ByV al source As Object, ByVal e As DataGridPageCha ngedEventArgs)
Me.DataGrid1.Cu rrentPageIndex = e.NewPageIndex
Me.doSearch()
End Sub
Public Sub doSearch()
Try
Me.DataView1.Ro wFilter = Me.Session.Item ("qry").ToStrin g
Me.OleDbDataAda pter1.Fill(Me.D ataSet21.Tables .Item(0))
Me.Response.Wri te(("<b>" & StringType.From Integer(Me.Data View1.Count) & " records found.</b><p>"))
Me.DataGrid1.Da taBind()
Catch exception2 As Exception
ProjectData.Set ProjectError(ex ception2)
Dim exception1 As Exception = exception2
Me.Response.Wri te(("Could not perform search, please try again" & ChrW(13) & "<!-- " & exception1.Mess age & "-->"))
ProjectData.Cle arProjectError( )
End Try
End Sub
<DebuggerStepTh rough()> _
Private Sub InitializeCompo nent()
.....parameters and declarations not shown here ......
Private Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
Me.InitializeCo mponent()
End Sub
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not Me.IsPostBack Then
Dim text1 As String = Me.Request.Item ("_mode")
If (Not Me.Request.Item ("_dir") Is Nothing) Then
Me.qry = ("surname like '" & Me.Request.Item ("_dir") & "%'")
ElseIf ((Not text1 Is Nothing) AndAlso (StringType.Str Cmp(text1, "adv", False) = 0)) Then
Dim num2 As Integer = (Me.Request.For m.Count - 1)
Dim num1 As Integer = 0
Do While (num1 <= num2)
If Not Me.Request.Form .Keys.Item(num1 ).StartsWith("_ ") Then
If (StringType.Str Cmp(Me.qry, "", False) <> 0) Then
Me.qry = (Me.qry & " AND ")
End If
Dim textArray1 As String() = New String() {Me.qry, "[", Me.Request.Form .Keys.Item(num1 ), "] like '%", Me.Request.Form .Item(num1), "%' "}
Me.qry = String.Concat(t extArray1)
End If
num1 += 1
Loop
End If
Me.Session.Item ("qry") = Me.qry
Me.doSearch()
End If
End Sub
' Properties
Protected Overridable Property DataGrid1() As DataGrid
Get
Return Me._DataGrid1
End Get
Set(ByVal WithEventsValue As DataGrid)
If (Not Me._DataGrid1 Is Nothing) Then
RemoveHandler Me._DataGrid1.P ageIndexChanged , New DataGridPageCha ngedEventHandle r(AddressOf Me.DataGrid1_Pa geIndexChanged)
End If
Me._DataGrid1 = WithEventsValue
If (Not Me._DataGrid1 Is Nothing) Then
AddHandler Me._DataGrid1.P ageIndexChanged , New DataGridPageCha ngedEventHandle r(AddressOf Me.DataGrid1_Pa geIndexChanged)
End If
End Set
End Property
Protected Overridable Property DataSet21() As DataSet2
Get
Return Me._DataSet21
End Get
Set(ByVal WithEventsValue As DataSet2)
If (Not Me._DataSet21 Is Nothing) Then
End If
Me._DataSet21 = WithEventsValue
If (Not Me._DataSet21 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property DataView1() As DataView
Get
Return Me._DataView1
End Get
Set(ByVal WithEventsValue As DataView)
If (Not Me._DataView1 Is Nothing) Then
End If
Me._DataView1 = WithEventsValue
If (Not Me._DataView1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbConnection 1() As OleDbConnection
Get
Return Me._OleDbConnec tion1
End Get
Set(ByVal WithEventsValue As OleDbConnection )
If (Not Me._OleDbConnec tion1 Is Nothing) Then
End If
Me._OleDbConnec tion1 = WithEventsValue
If (Not Me._OleDbConnec tion1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbDataAdapte r1() As OleDbDataAdapte r
Get
Return Me._OleDbDataAd apter1
End Get
Set(ByVal WithEventsValue As OleDbDataAdapte r)
If (Not Me._OleDbDataAd apter1 Is Nothing) Then
End If
Me._OleDbDataAd apter1 = WithEventsValue
If (Not Me._OleDbDataAd apter1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbDeleteComm and1() As OleDbCommand
Get
Return Me._OleDbDelete Command1
End Get
Set(ByVal WithEventsValue As OleDbCommand)
If (Not Me._OleDbDelete Command1 Is Nothing) Then
End If
Me._OleDbDelete Command1 = WithEventsValue
If (Not Me._OleDbDelete Command1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbInsertComm and1() As OleDbCommand
Get
Return Me._OleDbInsert Command1
End Get
Set(ByVal WithEventsValue As OleDbCommand)
If (Not Me._OleDbInsert Command1 Is Nothing) Then
End If
Me._OleDbInsert Command1 = WithEventsValue
If (Not Me._OleDbInsert Command1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbSelectComm and1() As OleDbCommand
Get
Return Me._OleDbSelect Command1
End Get
Set(ByVal WithEventsValue As OleDbCommand)
If (Not Me._OleDbSelect Command1 Is Nothing) Then
End If
Me._OleDbSelect Command1 = WithEventsValue
If (Not Me._OleDbSelect Command1 Is Nothing) Then
End If
End Set
End Property
Protected Overridable Property OleDbUpdateComm and1() As OleDbCommand
Get
Return Me._OleDbUpdate Command1
End Get
Set(ByVal WithEventsValue As OleDbCommand)
If (Not Me._OleDbUpdate Command1 Is Nothing) Then
End If
Me._OleDbUpdate Command1 = WithEventsValue
If (Not Me._OleDbUpdate Command1 Is Nothing) Then
End If
End Set
End Property
' Fields
<AccessedThroug hProperty("Data Grid1")> _
Public _DataGrid1 As DataGrid
<AccessedThroug hProperty("Data Set21")> _
Private _DataSet21 As DataSet2
<AccessedThroug hProperty("Data View1")> _
Private _DataView1 As DataView
<AccessedThroug hProperty("OleD bConnection1")> _
Private _OleDbConnectio n1 As OleDbConnection
<AccessedThroug hProperty("OleD bDataAdapter1") > _
Private _OleDbDataAdapt er1 As OleDbDataAdapte r
<AccessedThroug hProperty("OleD bDeleteCommand1 ")> _
Private _OleDbDeleteCom mand1 As OleDbCommand
<AccessedThroug hProperty("OleD bInsertCommand1 ")> _
Private _OleDbInsertCom mand1 As OleDbCommand
<AccessedThroug hProperty("OleD bSelectCommand1 ")> _
Private _OleDbSelectCom mand1 As OleDbCommand
<AccessedThroug hProperty("OleD bUpdateCommand1 ")> _
Private _OleDbUpdateCom mand1 As OleDbCommand
Private qry As String
End Class