what is the error in the bleow: 'Public Event OnFilterAdded()' is an event, and cannot be called directly. Use a
'RaiseEvent' statement to raise an event.

Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports Tawammar.CustomControls
Partial Class Filter
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
DataFilter2.DataSource = SqlDataSource2
DataFilter2.DataColumns = GridView1.Columns
DataFilter2.FilterSessionID = "Default.aspx"
DataFilter2.OnFilterAdded += (DataFilter2.OnFilterAdded + New
DataFilter.RefreshDataGridView(DataFilter2_OnFilterAdded)) 
End Sub 
Protected Overrides Sub OnLoadComplete(ByVal e As EventArgs)
If Not Page.IsPostBack Then
DataFilter2.BeginFilter()
DataFilter2.AddNewFilter("Emp_ID", "Emp_Name", "Dav")
End If
End Sub

Private Sub DataFilter2_OnFilterAdded()
Try
DataFilter2.FilterSessionID = "Default.aspx"
DataFilter2.FilterDataSource()
GridView1.DataBind()
Catch e As Exception

End Try
End Sub

i know the erorr in

DataFilter2.OnFilterAdded += new DataFilter.RefreshDataGridView(DataFilter2_OnFilterAdded);

i replaced + with & but it does not work

Recommended Answers

You need to read and understand the concepts here: http://msdn.microsoft.com/en-us/library/wkzf914z%28v=vs.71%29.aspx

This explains events and how they are raised.

Jump to Post

All 2 Replies

AddHandler DataFilter2.OnFilterAdded , AddressOf DataFilter2_OnFilterAdded
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.