ObjectDataSource control and app_script classses RRS feed

  • Question

  • User1946055038 posted

    I usually define domain objects in the app_code folder or in separate referenced dll’s when building asp.net web apps (vb, c#). Then, when using one of the data controls (like the GridView data control), I’m able to bind to a “ObjectDataSource” and have the source of this control be one of the domain objects defined in either the app_code or a referenced dll. The ObjectDataSource doesn’t appear to currently work when used on an IronPython page.

    For example, regardless if I create python domain classes in my app_script folder, or other non python referenced external dll’s, the object data source does not recognize any of these classes as valid data sources. If I add another aspx page (of type vb or c#, not IronPython) to the same web project and then add a Gridview and ObjectDatasource to this non IronPython page, the ObjectDatasource wizard is able to find all the non IronPython classes referenced by the project and they are available as the source for an ObjectDatasource control.

    Will we eventually be able to define IronPython classes in our app_script folder, and then use this as an ObjectDataSource on an IronPython aspx?

    Tuesday, December 19, 2006 5:02 PM

All replies

  • User1641955678 posted

    Hi Scott, 

    The problem is that IronPython classes are not real types in the framework sense.  i.e. you can't get a System.Type for them and reflect on the members, which is what ObjectDataSource needs to do.

    I think the solution may be to come up with a new type of data source which is more friendly to script objects.  We have that on our list of things to investigate.


    Wednesday, December 20, 2006 8:35 PM
  • User1946055038 posted

    Thanks for the feedback David.

    I sort of expected a problem reflecting upon the Python dynamic script classes, but was surprised that an ObjectDataSource placed on an IP aspx page was not able to reflect upon externally referenced dll’s (i.e. vb.net and c# dlls’).

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>


    Thursday, December 21, 2006 11:10 AM
  • User1641955678 posted

    I'm sorry, I didn't read your initial mail carefully enough.  I also don't understand why it would affect the case where you reference non-Python types.  To make sure I understand:

    • Say you have a C# page with no code and a working ObjectDataSource pointing to classes in App_Code
    • You then simply change the page's language to IronPython (trivial since there is no code), and and no longer works?  What error are you getting?



    Thursday, December 21, 2006 4:49 PM
  • User1946055038 posted

    Dave, here are some bullet points:

    • Create an IronPython web project
    • Either reference an external dll that defines a few business domain classes, and/or create them in app_code folder of the above project. Use either vb or c# to create these classes.
    • Add a new webform to the project, making sure that its language is set to IronPython.
    • Switch to design view, and drop an ObjectDataSource onto the page.
    • Use the ObjectDataSource's smart tag "configure data source", then on the configure data source wizzard, open the drop down list labled "choose your business object". Notice that it's empty.
    • Delete the ObjectDataSource. Switch back to source view and change the language to "VB" in the aspx.
    • Save the aspx, close the webform (the form should always be closed and re-opened when switching languages)
    • Re-open the webform, switch back to the design view, use the smart tag again to "configure data source". This time when you open the "choose your business object" dropdown the list is populated with your reflected class types.
    • Delete the ObjectDataSource from the page, switch back to source view, and change the language back to IronPython.
    • Save and close the page.
    • Re-open the page, switch to design view, and an ObjectDataSource, choose "configure data source", then open the "choose your business object" dropdown. Notice it's empty again.



    Friday, December 22, 2006 10:26 AM
  • User1641955678 posted

    Thanks Scott, I am now able to repro the issue.  Note that this is purely a designer issue, and not a runtime issue.  So even though the wizard is broken, if you get the correct ObjectDataSource in your page (e.g. by copying from C# page, ...), it should run just fine.

    I will report the issue to the designer team.


    Friday, December 22, 2006 3:12 PM