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

RadComboBox in grid template - different sources for Insert and Edit

8 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Newbery
Top achievements
Rank 1
Steve Newbery asked on 28 Aug 2008, 02:40 PM
I have a RadComboBox in an EditItemTemplate in my RadGrid. The problem is that I need different data source for the combobox in Insert and Edit modes.

How can I switch the datasource dynamically?

8 Answers, 1 is accepted

Sort by
0
Missing User
answered on 28 Aug 2008, 03:11 PM
Hello Steve,


Please find attached the sample web application that demonstrates the needed approach.

All the best,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Steve Newbery
Top achievements
Rank 1
answered on 29 Aug 2008, 01:40 PM
Great, thanks very much Plamen.
0
Garee
Top achievements
Rank 2
answered on 29 Sep 2008, 09:13 AM
Hi,

I'm trying to do something similar but this example doesn't work when the EditMode property for the MasterTableView is set to InPlace.

The problem seems to be that there's no way of detecting in the ItemDataBound event that an item is being edited, i.e. e.Item.IsInEditMode always returns false when EditMode is InPlace.

Am I missing something?

Thanks,

Gary
0
Sebastian
Telerik team
answered on 29 Sep 2008, 10:05 AM
Hi Garee,

The differences between InPlace and EditForms auto-generated editing are outlined under the following topics in the RadGrid documentation:

http://www.telerik.com/help/aspnet-ajax/grdeditmodeinplace.html
http://www.telerik.com/help/aspnet-ajax/grdeditforms.html

I believe that they can help you address the issue you are currently facing.

Kind regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Garee
Top achievements
Rank 2
answered on 29 Sep 2008, 10:31 AM
Hi Stephen,

Thanks for the quick response.

I've read both those articles and tried using the ItemCreated and ItemDataBound events, and casting the e.Item to GridEditableItem. I'm still not able to detect a difference between an Insert and an Edit though when the EditMode is set to InPlace.

I must be missing something as I'm sure it can't be so difficult to have different behaviour for insert and update operations. I just have a simple table where I want the user to provide values for all fields on insert, but only be able to edit a subset of those fields on subsequent updates.

Can you give me any more pointers?

Cheers,

Gary
0
Missing User
answered on 02 Oct 2008, 10:31 AM
Hi Garee,



When InPlace editing is applied, the grid item is of type GridEditableItem in edit mode and  GridDataInsertItem in insert regime. Please find attached modified project. Download it and give it a try.

Best wishes,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Garee
Top achievements
Rank 2
answered on 02 Oct 2008, 11:48 AM
Hi Plamen,

That's exactly what I was after - excellent!

I wasn't aware of the GridDataInsertItem class which is why I think I got stuck on this, so can I suggest a slight change to the wording on the following section of the documentation to mention this class in addition to the GridEditableItem class.

http://www.telerik.com/help/aspnet-ajax/grdeditmodeinplace.html

Or possibly on the following page:

http://www.telerik.com/help/aspnet-ajax/grdinsertingvaluesinplaceandeditforms.html

Thanks once again for your help.

Gary
0
Sebastian
Telerik team
answered on 06 Oct 2008, 03:42 PM
Hello Garee,

Thank you for the suggestion - the information will be included for the next version of the RadGrid documentation to the Insert/Update/Delete records -> Edit Mode -> In place topic. Your Telerik points have been updated for the feedback.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Steve Newbery
Top achievements
Rank 1
Answers by
Missing User
Steve Newbery
Top achievements
Rank 1
Garee
Top achievements
Rank 2
Sebastian
Telerik team
Share this question
or