ObjectDataSource, GridView and .NET Web Services

To the best of my knowledge, most of the sites that talk about GridView and business objects in .NET 2.0 explain the steps involved in creating those business objects and using ObjectDataSource control to bind to GridView control. But, what if you have to interface through web services and cannot access the business object directly? Its pretty easy. The following are the steps involved in binding web services to ObjectDataSoure control.

1. Add a web reference to the web service.
2. On a ASP.NET web form, drag GridView control and click on the Choose Data Source from the list of available entries.
3. Select Object from the list of data source types.
4. On the next page, the list of business objects shows all public methods from the web service. You should be careful to select the main name for the webservice. (e.g) localhost.MyWebService
5. On clicking Next, choose a method that you would like to run.
6. If you would like to enable paging, this is the time to do so.
7. Press F5 to check your results.

11 Responses to “ObjectDataSource, GridView and .NET Web Services”

  1. Hi,

    Hi vasudevan,

    I was wondering if you could send me some sample code of how to use the objectdatasource with a web service.

    I am struggling to do that and it would help me a lot to see a sample code.




  2. Note that most Web Services require authentication through some sort of header object. If you try and load a Data Source using a method that needs to be called AFTER authentication, then you’re going to run into problems.

  3. gilbert espina Says:

    my problem is when i’m accessing the method from my web service which is windows authenticated i’ve got the message “access denied” is there any sol’n please help

  4. Hello:

    Thanks for the information.

    My web serivice has different methods instead of select, update, and insert etc. How to get those method when clicking next button. I was not allow to add own method. Thanks

  5. Now explain all of the above steps programmatically. What if we want to instantiate the gridview, the objectdatasource and the web service all programmatically at run time for dynamic forms for example?

  6. Similar to the cue ball that is shot in pools; this game involves coins and strikers that are essential to play carrom game.

    Imagine never having to worry about what to wear to work, and even the infuriating traffic jams that never seem to end.
    Harry Potter Hogwarts is one more entry into this new series of LEGO board

  7. Upon examining some etymological dictionaries, one can conclude
    that games are a creative expression of the human spirit through the
    creation of an activity that has an entertaining, instructive and competing element.
    Port forwarding lets you specify which ports the game needs
    to perform at it’s best. As ever we strive to help our customers make informed decisions and understand where their r4 cards are coming from.

  8. clients, Rachel, who got back together with her ex.
    All spaceship game leveling systems are designed slightly differently, but there are some general concepts that apply to all games in this genre.
    The main reason why you would want to do this is simple, you can unlock
    the true potential of your purchase.

  9. If you find it a bit maddening to follow the
    daily fluctuations of the scale even though you are
    eating properly, pick three days of the week on which you
    will always weigh yourself (for example, Monday, Wednesday,
    and Friday). Cucumber contains sterols which can help to lower cholesterol and prevent carbohydrates from converting to body fat.

    Now, the average healthy amount people are supposed to lose is 2 pounds per week.

  10. s better to use whole foods made from scratch for good health.

    Vinson had participants keep their normal diet and
    exercise routines (or lack thereof) and merely added
    the green coffee. Hence, broccoli is a must-add ingredient in your vegetarian weight
    loss diet.

  11. Good way of describing, and good article to take facts on the topic of my
    presentation topic, which i am going to convey in college.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: