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

Access Grid EditForm popUp

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 09 Jul 2012, 02:08 PM
Hi,

I need your help to the following problem. I have a RadGrid which displays some records. Each record can be edit using PopUp Edit Form which is of type WebUserControl (see sample code below)

<telerik:RadGrid ID="grid" runat="server" OnItemCreated="grid_ItemCreated" OnEditCommand="grid_EditCommand"
AutoGenerateColumns="False"  OnNeedDataSource="grid_NeedDataSource"  >
<MasterTableView DataKeyNames="Id" EditMode="PopUp" EnableViewState="true">
    <Columns>
        ...
    </Columns>
    <EditFormSettings UserControlName="~/MyControl.ascx" EditFormType="WebUserControl"  PopUpSettings-Modal="true">
    </EditFormSettings>
</MasterTableView>
</telerik:RadGrid>

On Edit command I want to pass the selected grid row values into the userControl(MyControl.ascx ) using the setter methods exist on the userControl. My problem is how can I get an instance of the userControl inside the grid_EditCommand in order to set the values.

Thanks
Pan

1 Answer, 1 is accepted

Sort by
0
Elliott
Top achievements
Rank 2
answered on 09 Jul 2012, 03:20 PM
it's done automatically
immediately after your <Columns> in your aspx file put this
<EditFormSettings UserControlName="my user control.ascx" EditFormType="WebUserControl">
</EditFormSettings>

then in the code behind of the user control
Private _dataItem As Object
Public Property DataItem() As Object
    Get
        Return Me._dataItem
    End Get
    Set(ByVal value As Object)
        Me._dataItem = value
    End Set
End Property
 any code that is on entry should be in the DataBinding event of the control i.e. filling in combo boxes
DataItem will be just that - the dataitem of the item being edited or inserted
Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
Elliott
Top achievements
Rank 2
Share this question
or