DATAGRID EVENT HANDLERS - NOT FIRING?

F

Frank Walsh

My question is regarding Datagrid's and some trouble I am experiencing
getting events to fire. Here goes:

My Page_Load Looks like this:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Not Page.IsPostBack Then

BindData()

End If

End Sub

My Pager Handler looks like this:

Sub PageIndexChanged_Click(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)

DataGrid1.CurrentPageIndex = e.NewPageIndex

BindData()

End Sub

My ASPX FILE DATAGRID DEF. LOOKS LIKE THIS

asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 16px; POSITION:
absolute; TOP: 256px"
runat="server" OnPageIndexChanged="PageIndexChanged_Click"
AllowPaging="True" PageSize="25"
AllowSorting="True"></asp:datagrid
So I would expect this code to fire the pager handler when i click a number
based on all the examples I've found. It however does not. Now I can get the
event to fire by removing the Not Ispostback clause. However, this ends up
calling my bindata function twice, once in page_load and once in the
handler. I have viewstate enabled on page, what am i missing?

Thank You

(e-mail address removed)
 
S

Scott M.

Your grid's event handler doesn't seem to have a "Handles
DataGrid1.PageIndex Changed" clause at the end.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top