Using GridDropDownColumn with OpenAccess

4 posts, 1 answers
  1. Andrew
    Andrew avatar
    70 posts
    Member since:
    Oct 2008

    Posted 27 May 2009 Link to this post

    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).

  2. Answer
    Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 27 May 2009 Link to this post

    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.
  3. DevCraft banner
  4. Andrew
    Andrew avatar
    70 posts
    Member since:
    Oct 2008

    Posted 27 May 2009 Link to this post

    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.
  5. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 03 Jun 2009 Link to this post

    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.
Back to Top