Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   DATAGRID EVENT HANDLERS - NOT FIRING? (http://www.velocityreviews.com/forums/t761953-datagrid-event-handlers-not-firing.html)

Frank Walsh 05-06-2005 09:23 PM

DATAGRID EVENT HANDLERS - NOT FIRING?
 
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@gmail.com




Scott M. 05-07-2005 11:34 AM

Re: DATAGRID EVENT HANDLERS - NOT FIRING?
 
Your grid's event handler doesn't seem to have a "Handles
DataGrid1.PageIndex Changed" clause at the end.


"Frank Walsh" <Frank.Walsh@gmail.com> wrote in message
news:uoDWfHoUFHA.3620@TK2MSFTNGP09.phx.gbl...
> 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@gmail.com
>
>
>





All times are GMT. The time now is 05:06 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.