using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using ContactWebRef; public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } private void LoadContacts() { ContactWebRef.Contact_Service InstContact = new ContactWebRef.Contact_Service(); InstContact.UseDefaultCredentials = true; ContactWebRef.Contact_Service[] Contacts = InstContact.ReadMultiple(null, null, 0); GridView1.DataSource = Contacts; } protected void Button1_Click(object sender, EventArgs e) { LoadContacts(); } }
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Ma page de test</title> </head> <body> <form id="form1" runat="server"> <div> <h3>Mon test ici</h3> <p> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> Website </p> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" onselectedindexchanged="GridView1_SelectedIndexChanged"> <Columns> <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" /> <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DB_00ConnectionString %>" SelectCommand="SELECT [Name], [Address] FROM [bii_copy$Contact]"> </asp:SqlDataSource> </div> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> </form> </body> </html>
Comments
Correct above code as (if Contact is the name of your WS):
ContactWebRef.Contact Contacts = InstContact.ReadMultiple(null, null, 0);
Pargesoft
:thumbsup:
thanks
You left "DataBind" Method.
Best Regards,
Yukon