DATAGRID EVENT HANDLERS - NOT FIRING?

Discussion in 'ASP .Net Datagrid Control' started by Frank Walsh, May 6, 2005.

  1. Frank Walsh

    Frank Walsh Guest

    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

     
    Frank Walsh, May 6, 2005
    #1
    1. Advertising

  2. Frank Walsh

    Scott M. Guest

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


    "Frank Walsh" <> wrote in message
    news:...
    > 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
    >
    >
    >
    >
    >
     
    Scott M., May 7, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edward Bills
    Replies:
    0
    Views:
    469
    Edward Bills
    Aug 25, 2004
  2. =?Utf-8?B?ZGFuYw==?=

    DataGrid ItemCommand event not firing if not first page

    =?Utf-8?B?ZGFuYw==?=, Oct 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,180
    =?Utf-8?B?ZGFuYw==?=
    Oct 26, 2005
  3. Dood
    Replies:
    1
    Views:
    636
  4. Mike Hofer

    Server-side event handlers firing twice

    Mike Hofer, Mar 14, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    474
    Mike Hofer
    Mar 14, 2006
  5. Replies:
    2
    Views:
    265
Loading...

Share This Page