locked
binding object datasource to webservice? RRS feed

  • Question

  • User-2104551191 posted

    MY webservice file is called customer.asmx and has the following code

    namespace CustomerWebService
    {
        [WebService(Namespace = "cust.wfmc.webservice")]
        public class customer : System.Web.Services.WebService
        {

    When I try to bind this to a object datsource from default.aspx page

    <asp:ObjectDataSource   id="srcCustprofile" TypeName="customer"  SelectMethod="GET_Cust_Profiles"    runat="server" />

    an error comes up saying

    The type specified in the TypeName property of ObjectDataSource 'srcCustprofile' could not be found.

    What is wrong here...Thank you


    Tuesday, October 25, 2011 11:35 AM

Answers

  • User3866881 posted

    but now I am datbinding it on the aspx.cs page..

    You can write a private function that will fetch all the data contents from WebService and everytime when you do submitting, call this directly——

    private void Binding()

    {

         DataTable dt = YourWebService.XXX();
         Gridview1.DataSource =dt;
         GridView1.DataBind();

    }

    And then handle RowEditing, RowDeleting……RowUpdating. Everytime when you finish a task, don't forget to call Binding.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 27, 2011 8:58 PM

All replies

  • User-608283337 posted

    add the following right under where you define the namespace for your webservice and see if that works for you.

     

    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

     

    second, double check the name of the method that you have entered for the SelectMethod property of your object datasource is define exactly the same in your web service as well.

    Tuesday, October 25, 2011 12:23 PM
  • User3866881 posted

    Hello  akpaga22:)

    "TypeName" defined in the ObjectDataSource should be the most element class of a collection that will be rendered back. e.g: Suppose your "GET_Cust_Profiles" returns a list of "custom" class, and the "TypeName" should be "custom".

    Wednesday, October 26, 2011 9:57 PM
  • User-2104551191 posted

    Thank you all for your responses..but now I am datbinding it on the aspx.cs page..

    Thursday, October 27, 2011 10:43 AM
  • User3866881 posted

    but now I am datbinding it on the aspx.cs page..

    You can write a private function that will fetch all the data contents from WebService and everytime when you do submitting, call this directly——

    private void Binding()

    {

         DataTable dt = YourWebService.XXX();
         Gridview1.DataSource =dt;
         GridView1.DataBind();

    }

    And then handle RowEditing, RowDeleting……RowUpdating. Everytime when you finish a task, don't forget to call Binding.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 27, 2011 8:58 PM