2

Basically I have a gridview that is loaded when a DataSet is returned from the web service, but going at it this way makes me lose some of the benefits of the gridview like the simplicity in sorting, updating, deleting, rows, etc.

Is there a way I can use a web service, but still have access to using a SqlDataSource binded to the GridView. I can't return a webcontrol like SqlDataSource, but maybe there is a way around?

2
  • A SqlDataSource implies local access to the data (a SQL data store), which you don't have from a web service. Commented Jul 25, 2011 at 17:19
  • I was hoping there was a way. I've been using ASP.NET for a week now, needed to know that, so I can advance to other possibilities.. Commented Jul 25, 2011 at 17:21

2 Answers 2

1

First of all, I suggest you to move from ASP.NET web-service to WCF-service - you can use the WCF Data Services. for example. You should note what this is not exactly the SqlDataSource.

But if you want to use the ASP.NET web-service, I think this article will help you: How To Use a Web Service as a Data Source for a Client Application in Visual C# .NET.

The main point is what you can setup your method to return a DataSet:

[WebMethod]
public DataSet GetCustOrders(string IDMask)
{
    // your code here
}

But Web-services are old technology and your shouldn't use them.

Sign up to request clarification or add additional context in comments.

Comments

1

Internally, no there is no seamless web service binding, either on the client or server. The SQLDataSource is meant to directly communicate with the database and ignore external components. If you switch to an ObjectDataSource, the method called can refer to a component, which then communicates with the web service, but on the server only.

Are you looking to do this on the client? Neither control supports client-side binding, but you can build the UI yourself, or use a JS equivalent control for binding such as ASP.NET AJAX 4.0 templates or the dataview component.

HTH.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.