コード例 #1
0
        // refreshes the gridView, If new records have been added they will be displayed
        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            var webService = new BooksWebServiceProxy.BooksWebServiceSoapClient();

            gvBookList.DataSource = webService.GetAllBooksWithAuthors();
            gvBookList.DataBind();
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            // Web Service methods are available webService.methodName() from this instance
            var webService = new BooksWebServiceProxy.BooksWebServiceSoapClient();

            // The GetAllBooksWithAuthors method is used as data source for the gridView
            // on form load
            gvBookList.DataSource = webService.GetAllBooksWithAuthors();
            gvBookList.DataBind();

            // The GetAllAuthors method is used as data source for the dropDownList
            // on form load
            var listOfAuth = webService.GetAllAuthors();

            ddlAuthor.DataSource     = listOfAuth;
            ddlAuthor.DataTextField  = "authorName";
            ddlAuthor.DataValueField = "authorId";
            ddlAuthor.DataBind();
        }