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

Detail Grid binding by Code

6 Answers 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Azmat
Top achievements
Rank 1
Azmat asked on 18 Mar 2009, 11:19 AM
Protected Sub RadGridProducts_ItemCommand(ByVal source As ObjectByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridProducts.ItemCommand 
        ViewState("GridItem") = e.Item ' gets the selected row for detail 
        LblException.Text = "" 
        Select Case e.CommandName 
             
        End Select 
    End Sub 
 
Protected Sub RadGridProducts_DetailTableDataBind(ByVal source As ObjectByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles RadGridProducts.DetailTableDataBind 
        Try 
            Dim item As GridItem = CType(ViewState("GridItem"), GridItem) 
            Dim ProductId As String = RadGridProducts.MasterTableView.DataKeyValues(item.ItemIndex)("Id").ToString() 
            Dim DTable As DataTable = DataAccess.Products.GetAllProductPricesById(ProductId) 
            RadGridProducts.MasterTableView.DetailTables(0).DataSource = DTable 
            RadGridProducts.MasterTableView.DetailTables(0).DataBind() 
        Catch ex As Exception 
        End Try 
    End Sub 
i want to bind the details table view  programmatically with the above code.
But This Gives an error as follows

Type 'Telerik.Web.UI.GridDataItem' in Assembly 'Telerik.Web.UI, Version=2008.3.1314.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4' is not marked as serializable.

Please Help me i dont want to use DataSource Controls as our Project DAL is written in classic way.
Thanks

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Mar 2009, 05:37 AM
Hi Azmat,

Hierarchical grid structure is not supported with simple data-binding (calling DataBind()). You may refer the following online demo to get more details about programmatically binding the Detail table.
Programmatic Binding

Shinu
0
Prateek
Top achievements
Rank 1
answered on 21 Apr 2014, 08:24 AM
I also have this problem. when I try to put gridDataItem in ViewState then this Error occur.
Plz help to sort out this problem..
I have checked the link provided above..

Thanks 
Prateek
0
Shinu
Top achievements
Rank 2
answered on 21 Apr 2014, 01:05 PM
Hi Prateek,

Can you make sure you are using the latest version of the Telerik. Try upgrading to the latest version of Telerik Controls. Based on the information furnished, it is hard to determine the precise cause. It would be best if you send us a small working project to find out the issue.

Thanks,
Shinu

0
Prateek
Top achievements
Rank 1
answered on 23 Apr 2014, 07:45 AM
Hi Shinu,
I am using the Latest version of telerik . my working project issue is as same as given above by Azmat..

Thanks 
Prateek
0
Shinu
Top achievements
Rank 2
answered on 23 Apr 2014, 10:20 AM
Hi Prateek,

Please provide your code snippet to replicate the issue.

Thanks,
Shinu



0
Angel Petrov
Telerik team
answered on 24 Apr 2014, 06:12 AM
Hello,

The problem is caused by the fact that the GridDataItem class is not marked as Serializable which means that it can not be stored in the ViewState. Could you please elaborate more on why exactly do you want to store the GridDataItem in the ViewState?

Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Azmat
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Prateek
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or