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

How to populate a control in custom template depending on primary keys

2 Answers 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fabio Laserra
Top achievements
Rank 1
Fabio Laserra asked on 30 Sep 2011, 11:40 AM
Hello,
I have an objectdatasource that populates a listbox. The objectdatarource select method requires two parameter (the PK of radgrid item).
When the Selecting event of objectdatasource is fired, I cannot access to current edit item, because edititems.count is =0. How can I retrive the primary keys of current edited row in this case?

THanks

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Sep 2011, 12:22 PM
Hello Fabio,

Here is the sample code to acess the edit form from an external event.
C#:
GridEditFormItem editItem= rgGrid1.MasterTableView.GetItems(GridItemType.EditFormItem)[0] as GridEditFormItem;

Regards,
Shinu.
0
Fabio Laserra
Top achievements
Rank 1
answered on 30 Sep 2011, 05:30 PM
Thank you. Your tip works only if I call the instruction from RadGrid1.InsertCommand event. If I call it from the DataSource.Selecting event of listbox I have to populate, it returns always the first item (not the first edited item).

any other suggestion?
Thanks
Tags
Grid
Asked by
Fabio Laserra
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Fabio Laserra
Top achievements
Rank 1
Share this question
or