Consume WebService Dataset

Discussion in 'ASP .Net Web Services' started by Bob, Nov 21, 2006.

  1. Bob

    Bob Guest

    Hi, I am new to Web Development.
    Using Framework 2.0
    Written a webservice that exposes a typed dataset and a webmethod that
    returns an instance of the typed dataset.

    On the client aspx page I can't see how to hook an instance of the dataset
    to a datasource.
    The objectDatasource configure wizard shows localhost.MyTypedDataset in a
    number of options.
    I assumed that I should choose 'localhost.MyTypedDataset +MyTable'
    The page displays, but where I would expect the datagrid there is just white
    space.
    The page_load code is below as is the Page Body xml

    Am I on the write track?
    thanks
    Bob
    ***********CODE*************
    public partial class FirstWebPage : System.Web.UI.Page

    {

    localhost.Service d;

    localhost.dsMeter ds;

    protected void Page_Load(object sender, EventArgs e)

    {

    d = new Service();

    ds = d.GetMeters();

    Label1.Text = "Success";

    }

    protected void Button1_Click(object sender, EventArgs e)

    {







    }

    }

    **********************XML BODY FOLLOWS******************

    <form id="form1" runat="server">

    <div>

    <strong>Welcome to Visual Web Developer Using Code Separation</strong>.<br
    />

    <br />

    <strong>Enter your name:</strong>.<br />

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    <asp:Button ID="Button1" runat="server" Text="Display Name"
    OnClick="Button1_Click" />

    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
    AllowPaging="True" DataSourceID="ObjectDataSource1"
    DataKeyNames="apartmentBlock,apartment">

    <Columns>

    <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />

    <asp:BoundField DataField="apartmentBlock" HeaderText="apartmentBlock"
    SortExpression="apartmentBlock" />

    <asp:BoundField DataField="apartment" HeaderText="apartment"
    SortExpression="apartment" />

    <asp:BoundField DataField="meter_number" HeaderText="meter_number"
    SortExpression="meter_number" />

    <asp:BoundField DataField="supplier_id" HeaderText="supplier_id"
    SortExpression="supplier_id" />

    <asp:CheckBoxField DataField="HasErrors" HeaderText="HasErrors"
    ReadOnly="True" SortExpression="HasErrors" />

    <asp:BoundField DataField="id" HeaderText="id" SortExpression="id" />

    <asp:BoundField DataField="RowError" HeaderText="RowError"
    SortExpression="RowError" />


    </Columns>

    </asp:GridView>

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
    SelectMethod="FindByid" TypeName="localhost.dsMeter+MeterDataTable"
    UpdateMethod="Merge">

    <UpdateParameters>

    <asp:parameter Name="table" Type="Object" />

    <asp:parameter Name="preserveChanges" Type="Boolean" />

    </UpdateParameters>

    <SelectParameters>

    <asp:ControlParameter ControlID="GridView1" Name="id"
    PropertyName="SelectedValue"

    Type="Int32" />

    </SelectParameters>

    </asp:ObjectDataSource>

    </div>

    </form>
     
    Bob, Nov 21, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. msnews.microsoft.com
    Replies:
    2
    Views:
    1,182
    =?Utf-8?B?R2FyeQ==?=
    May 19, 2004
  2. Paul Hermans

    Consume php webservice in asp.net

    Paul Hermans, Jun 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    946
    bruce barker
    Jun 10, 2004
  3. weetat

    Consume Webservice in java

    weetat, Apr 4, 2007, in forum: Java
    Replies:
    3
    Views:
    27,256
    weetat
    Apr 4, 2007
  4. Timo
    Replies:
    2
    Views:
    491
  5. dgleeson422111

    consume local web service -ok consume remote service - Not OK

    dgleeson422111, Jan 26, 2010, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    1,650
    dgleeson422111
    Jan 31, 2010
Loading...

Share This Page