Consume WebService Dataset

B

Bob

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top