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

[Solved] Editing in Grid with User Control and Business Objects

1 Answer 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wai Chiu Lau
Top achievements
Rank 1
Wai Chiu Lau asked on 02 Mar 2008, 11:15 AM
Hi,

We want to use the user control edit feature of the RadGrid. We have a user control with a method LoadForm(ID) which takes the ID of a Product and loads it using custom business objects. Something like:

Public Sub LoadForm(ByVal ID As Integer)
    Dim BO As Product = Product.Load(ID)
    With BO
        tbName.Text = .Name
        tbPrice.Text = .Price
        ...
    End With
End Sub

Now I am trying to use this user control in the grid. In all the examples I have seen so far DataSets or DataTables are used. Is there any example of using this edit feature with custom business objects.

The problem is that when I do something like (see below), then MyUserControl is a generic control and I can't call methods in it.

Dim

editedItem As GridEditableItem = CType(e.Item, GridEditableItem)

Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)

Tahir

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 05 Mar 2008, 09:36 AM
Hello Wai Chiu Lau,

Did you try casting to your user control's type? Similar to this:

Dim MyUserControl As MyUserControlType = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), MyUserControlType)  
 

Greetings,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Wai Chiu Lau
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or