This is a migrated thread and some comments may be shown as answers.

Problem in Managing data into two grids on a page

3 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Naveen
Top achievements
Rank 1
Naveen asked on 02 Dec 2010, 12:17 PM
I have two rad grids on a page. The concept is the top grid gets the data at page load and the bottom one is empty at that time. On making some selections in the top grid and pressing a button to drag the selected ones to the bottom grid. Every thing works fine except that after making the drag the top grid doesn't loads the data from the next page in the pagination. To understand it better lets say I'v set the page size of the top grid as 8 and if make all of the them selected and dragged the top grid says "No records to display" even if there are more data available in next pages of the pagination. If I changes my code to make the pagesize of the grid as "pageSize = Me.dgProjects.PageSize" the top grid displays two more items if all 8 of the items on the first page is selected. But on selecting these two again the problem again begins as described above.

I'm a novice in ASp.NET. Please help me accordingly.

Thanks


Code is here

Protected Sub dgProjects_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles dgProjects.NeedDataSource
            dgDataBind = True
            Me.LoadSelectionList()
        End Sub
        Protected Sub LoadSelectionList()
            Dim dg As Telerik.Web.UI.RadGrid
            Dim ds As DataSet
            Dim sortField As String = "name"
            Dim sortOrder As String = "ASC"
            Dim sortOrder1 As String = "DESC"
            Dim filterExpression As String
            Dim pageSize As Int16
            Dim currentPageIndex As Int16
            dg = Me.dgProjects
            'pageSize = 8
            pageSize = Me.dgProjects.PageSize
            currentPageIndex = dg.CurrentPageIndex + 1
            filterExpression = Me.dgProjects.MasterTableView.FilterExpression
            If dg.MasterTableView.SortExpressions.Count > 0 Then
                sortField = dg.MasterTableView.SortExpressions(0).FieldName
                If (dg.MasterTableView.SortExpressions(0).SortOrder = GridSortOrder.Descending) Then
                    sortOrder = "DESC"
                    sortOrder1 = "ASC"
                End If
            Else
                sortField = "name"
            End If
            ds = Project.getProjectsByUserId(userId, selectedVendors(), currentPageIndex, pageSize, filterExpression, sortField, sortOrder, Request.QueryString("Postingid"))
            ' Get # of rows in querry
            ' number of rows will be in table 0
            ' data will be in table 1
            If ds.Tables.Count > 0 Then
                Dim row As DataRow
                For Each row In ds.Tables(0).Rows
                    dg.VirtualItemCount = Convert.ToInt32(row("rows"))
                Next row
            End If
            dg.DataSource = ds.Tables(1)

            If dgDataBind = True Then
                dgDataBind = False
            Else
                dg.DataBind()
            End If



Protected Sub dgProjects_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles dgProjects.ItemCreated
            If TypeOf e.Item Is Telerik.Web.UI.GridFilteringItem Then
                Dim filteringItem As Telerik.Web.UI.GridFilteringItem = CType(e.Item, Telerik.Web.UI.GridFilteringItem)
                Dim box As TextBox
                Dim myimage As Image

                'box = CType(filteringItem("chkBox").Controls(0), TextBox)
                'box.Visible = False
                'myimage = CType(filteringItem("chkBox").Controls(1), Image)
                'myimage.Visible = False

            End If
        End Sub

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 02 Dec 2010, 04:56 PM
Hello Naveen,

Note that you should never call DataBind() when using advanced data-binding through NeedDataSource. I suggest that you review the following help topic for more information:
http://www.telerik.com/help/aspnet-ajax/grdadvanceddatabinding.html

All the best,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Naveen
Top achievements
Rank 1
answered on 03 Dec 2010, 06:30 AM
Thanks for the reply.

I did what you said and have commented out all the dataBind(). Now the problem created is that now after making the selection and dragging, the top grid persistes the same data from 1st page, i.e. if I select all the items that come on 1st page of the top grid and drag it. Both the grid shows the same items and in the top-grid all the items remained checked. I need that if I do what I described the top grid load the next items from the page 2 and the pagination info at the bottom of this grid update accordingly.
0
Pavlina
Telerik team
answered on 07 Dec 2010, 12:52 PM
Hello Naveen,

Could you please open a formal support ticket and send us small runnable application which demonstrates the issue? We will test it locally and advise you further.

Regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Naveen
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Naveen
Top achievements
Rank 1
Share this question
or