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

Using GridDropDownColumn with OpenAccess

3 Answers 68 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 1
Andrew asked on 27 May 2009, 11:48 AM
Hi,

I am sure that I am missing something blindingly obvious, but, I want to (declaratively) use the GridDropDownColumn in my grid where both the Grid and the DropDown are bound to OpenAccessDataSources. The grid displays properly, but when I edit a row, I get the following error message.

Invalid cast from 'System.String' to 'MyNameSpace.SPool'.


The Declaration in the grid is as follows

                <telerik:GridDropDownColumn DataField="SPool" 
                    HeaderText="Pool ID" SortExpression="SPool" UniqueName="SPool" 
                    DataSourceID="OpenAccessDataSourcePoolIDs" DropDownControlType="DropDownList" 
                    ListValueField="PoolId" ListTextField="PoolId" 
                > 
 

The obvious problem being that the PoolId in the Class SPool is a string, and I presumably, want to make ListValueField refer to the instance of the Class that has been selected in the DDL.

Can someone point me in the right direction. I woudl liek to avoid code behind for this if I can (ese I end up writing quite a lot of it).

3 Answers, 1 is accepted

Sort by
0
Accepted
Zoran
Telerik team
answered on 27 May 2009, 04:20 PM
Hello Andrew,

The thing is that you try to present a complex type in the combo-box column of the grid e.g. you have set the DataField to "SPool". I advise you read the following KB article where the scenario you have is discussed. In the code-library that contains the sample from the KB we are using a GridDropDownCollumn and it should really help you. I just want to notice that the workaround that we offer in the KB is only a temporary solution, this process will be automated and out of the box in future OpenAcces releases.

If you require further clarification on the issue please give us you feedback, we will do everything possible to help you achieving your goal.

Kind regards,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Andrew
Top achievements
Rank 1
answered on 27 May 2009, 10:31 PM
Hi Zoran ,

Many thanks for the response - yes it answers my problem. Though you might want to enhance the article just a bit to show how the code originally looked (before the changes).

I did spend some time searching the support site looking for this - since it seemed obvious that I coudl not be the first person to need the solution. I tried quite a few combinations of OpenAccess, GridDropDownColumn and the error message, but the only thread I could find that seemed relevant was Forum Article which I found to be rather incomplete (and actually a little misleading - have a look at the code posted ).

Do you have any idea when this might become part of OA - I ask partly because I note that some of the code gets lost when the Reverse Mapping wizard is used to update the Object Model - and since my project is under heavy development I will be having to use it quite a bit - and also because I woudl like to get access to the "DataBase" reference values for some of my reporting intentions (and preferably not by having to go via the referenceed object - in my case the database reference is sufficient for most filtering and display purposes since the key value is also the name/text value).

Andrew

P.S. I am still impressed with the speed with which you answer question like this.
0
Zoran
Telerik team
answered on 03 Jun 2009, 12:55 PM
Hi Andrew,

This is a functionality we have planned for our Q3 release or maybe in some of the patches between Q2 and Q3. For now you should use the workaround but, we will notify you as soon a the functionality is in place.

Sincerely yours,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Getting Started
Asked by
Andrew
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or