Custom ObjectDataSource from WCF

Last post 05-22-2008 3:30 AM by rudy1250. 2 replies.

Sort Posts:

  • Custom ObjectDataSource from WCF

    05-16-2008, 12:42 PM
    • Loading...
    • rudy1250
    • Joined on 05-16-2008, 12:39 PM
    • Posts 12

    I’m trying to make my own ObjectDataSource in my .NET Web Project. This is my approach:

    I have a class that returns an object (called from WCF). The object is consumed by a ObjectDataSource. The ObjectDataSource has a selectmethod that picks up the object I’ve created in my class.

    When the user clicks a button, the method is called and filled with parameters so and the object is filled with the result from WCF. The object has a return value but their isn’t anything appearing in my DataGrid.

    Do I need to fill the ObjectDataSource object? Does it doesn’t this automatically when the method is fired? Am I missing something?

    Any help is appreciated!!

     

      

     
    1    
    2       "ObjectDataSource1" runat="server" 
    3            SelectMethod="getWCFObject" 
    4            TypeName="MyApp.MyObjectClass">
    5            
    6                "id" Type="String" />
    7                "businessProcessStepId" Type="String" />
    8                "businessProcessStepType" Type="String" />
    9                "handledStatusCollection" Type="Object" />
    10               "serviceStatusCollection" Type="Object" />
    11               "succeeded" Type="Boolean" />
    12               "startDate" Type="DateTime" />
    13               "endDate" Type="DateTime" />
    14               "environmentId" Type="Int32" />
    15               "rowCount" Type="Int32" />
    16           
    17       
    18   
    19   "myGrid" runat="server" DataSourceID="ObjectDataSource1" 
    20                   AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" 
    21                   GridLines="None">
    22           "#990000" Font-Bold="True" ForeColor="White" />
    23           "#FFFBD6" ForeColor="#333333" />
    24           "#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
    25           "#FFCC66" Font-Bold="True" ForeColor="Navy" />
    26           "#990000" Font-Bold="True" ForeColor="White" />
    27           "White" />
    28       
    29   
    
     
  • Re: Custom ObjectDataSource from WCF

    05-20-2008, 10:36 PM
    Answer

    Hi rudy1250,

    Since you've bind the ObjectDataSource to a DataGird, the SelectMethod of ObjectDataSource will be automaticlly called when DataGrid calls DataBind method OR specify DataSourceID property. But you said there's nothing in dataGrid. So I suggest you can set break points in the GetWCFObject method, and debug your application. In this case, you can easily see how the method returns a null result. Hope this helps you!

     

    Thanks.

    Sincerely,
    JanIvan Qian

    Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
  • Re: Custom ObjectDataSource from WCF

    05-22-2008, 3:30 AM
    • Loading...
    • rudy1250
    • Joined on 05-16-2008, 12:39 PM
    • Posts 12

     well it was about the parameters not be filled in in the selection method of the ODS.

     

    protected void myQuery_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
            {


                e.InputParameters["paramhere"] = null;

            } 

     

    thx for clearing this up 

Page 1 of 1 (3 items)
Microsoft Communities
Page view counter