paging problem

Results 1 to 2 of 2

Thread: paging problem

  1. #1
    Join Date
    Dec 1969

    Default paging problem

    hi friends,<BR>I&#039;m facing an "Object Expected" JScript error while doing default paging in datagrid...<BR>I am not able to track it.<BR>I am populating my datagrid from database based on a query string made with one querystring variable I am receiving.<BR>below is my code<BR><BR><BR>Private Sub showpaging(ByRef datagr As DataGrid)<BR> datagr.AllowPaging = True<BR> datagr.PagerStyle.HorizontalAlign = HorizontalAlign.Right<BR> RaiseEvent datagrid1_pageindexchanged()<BR> datagr.PagerStyle.PageButtonCount = 10<BR> datagr.PageSize = 10<BR> datagr.PagerStyle.Mode = PagerMode.NumericPages<BR>End Sub<BR><BR>and this is my eventhandler<BR><BR>Public Sub changepageindex(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs) Handles datagrid1.PageIndexChanged<BR> datagrid1.CurrentPageIndex = e.NewPageIndex<BR> datagrid1.DataBind()<BR>End Sub<BR>any idea what could be the problem<BR>anurag

  2. #2
    Join Date
    Dec 1969

    Default RE: Where's the data source

    I think that you may be losing the dataset you are using for your datagrid data source when you post back for the page change.<BR><BR>Unless you are refreshing the dataset with your page_load event or preserving it in some way, there is no dataset object to bind to.<BR><BR>I see you are raising an event for the pageindexchanged event of the datagrid. Why not just set the datagrid OnPageIndexChanged property?<BR><BR>datagr.OnPageIndexChanged = "changepageindex(obj As Object, e As DataGridPageChangedEventArgs)"<BR><BR>I also notice that you are setting properties for a datagrid named datagr but your sub call references datagrid1. Aren&#039;t these two different objects?<BR><BR>Hope this gives you some things to look at.<BR><BR>Good Luck.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts